//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{}
)

// ChatPhotoClassArray is adapter for slice of ChatPhotoClass.
type ChatPhotoClassArray []ChatPhotoClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsChatPhoto returns copy with only ChatPhoto constructors.
func ( ChatPhotoClassArray) () ( ChatPhotoArray) {
	for ,  := range  {
		,  := .(*ChatPhoto)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AppendOnlyNotEmpty appends only NotEmpty constructors to
// given slice.
func ( ChatPhotoClassArray) ( []*ChatPhoto) []*ChatPhoto {
	for ,  := range  {
		,  := .AsNotEmpty()
		if ! {
			continue
		}
		 = append(, )
	}

	return 
}

// AsNotEmpty returns copy with only NotEmpty constructors.
func ( ChatPhotoClassArray) () ( []*ChatPhoto) {
	return .AppendOnlyNotEmpty()
}

// FirstAsNotEmpty returns first element of slice (if exists).
func ( ChatPhotoClassArray) () ( *ChatPhoto,  bool) {
	,  := .First()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// LastAsNotEmpty returns last element of slice (if exists).
func ( ChatPhotoClassArray) () ( *ChatPhoto,  bool) {
	,  := .Last()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// PopFirstAsNotEmpty returns element of slice (if exists).
func ( *ChatPhotoClassArray) () ( *ChatPhoto,  bool) {
	,  := .PopFirst()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// PopAsNotEmpty returns element of slice (if exists).
func ( *ChatPhotoClassArray) () ( *ChatPhoto,  bool) {
	,  := .Pop()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// ChatPhotoArray is adapter for slice of ChatPhoto.
type ChatPhotoArray []ChatPhoto

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}