//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// AccountThemesClassArray is adapter for slice of AccountThemesClass.
type AccountThemesClassArray []AccountThemesClass

// Sort sorts slice of AccountThemesClass.
func ( AccountThemesClassArray) ( func(,  AccountThemesClass) bool) AccountThemesClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of AccountThemesClass.
func ( AccountThemesClassArray) ( func(,  AccountThemesClass) bool) AccountThemesClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of AccountThemesClass.
func ( AccountThemesClassArray) ( func( AccountThemesClass) bool) AccountThemesClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( AccountThemesClassArray) () ( AccountThemesClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( AccountThemesClassArray) () ( AccountThemesClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *AccountThemesClassArray) () ( AccountThemesClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  AccountThemesClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *AccountThemesClassArray) () ( AccountThemesClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsAccountThemes returns copy with only AccountThemes constructors.
func ( AccountThemesClassArray) () ( AccountThemesArray) {
	for ,  := range  {
		,  := .(*AccountThemes)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AppendOnlyModified appends only Modified constructors to
// given slice.
func ( AccountThemesClassArray) ( []*AccountThemes) []*AccountThemes {
	for ,  := range  {
		,  := .AsModified()
		if ! {
			continue
		}
		 = append(, )
	}

	return 
}

// AsModified returns copy with only Modified constructors.
func ( AccountThemesClassArray) () ( []*AccountThemes) {
	return .AppendOnlyModified()
}

// FirstAsModified returns first element of slice (if exists).
func ( AccountThemesClassArray) () ( *AccountThemes,  bool) {
	,  := .First()
	if ! {
		return
	}
	return .AsModified()
}

// LastAsModified returns last element of slice (if exists).
func ( AccountThemesClassArray) () ( *AccountThemes,  bool) {
	,  := .Last()
	if ! {
		return
	}
	return .AsModified()
}

// PopFirstAsModified returns element of slice (if exists).
func ( *AccountThemesClassArray) () ( *AccountThemes,  bool) {
	,  := .PopFirst()
	if ! {
		return
	}
	return .AsModified()
}

// PopAsModified returns element of slice (if exists).
func ( *AccountThemesClassArray) () ( *AccountThemes,  bool) {
	,  := .Pop()
	if ! {
		return
	}
	return .AsModified()
}

// AccountThemesArray is adapter for slice of AccountThemes.
type AccountThemesArray []AccountThemes

// Sort sorts slice of AccountThemes.
func ( AccountThemesArray) ( func(,  AccountThemes) bool) AccountThemesArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of AccountThemes.
func ( AccountThemesArray) ( func(,  AccountThemes) bool) AccountThemesArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of AccountThemes.
func ( AccountThemesArray) ( func( AccountThemes) bool) AccountThemesArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( AccountThemesArray) () ( AccountThemes,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( AccountThemesArray) () ( AccountThemes,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *AccountThemesArray) () ( AccountThemes,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  AccountThemes
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *AccountThemesArray) () ( AccountThemes,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}