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

// InputPhotoClassArray is adapter for slice of InputPhotoClass.
type InputPhotoClassArray []InputPhotoClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsInputPhoto returns copy with only InputPhoto constructors.
func ( InputPhotoClassArray) () ( InputPhotoArray) {
	for ,  := range  {
		,  := .(*InputPhoto)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillNotEmptyMap fills only NotEmpty constructors to given map.
func ( InputPhotoClassArray) ( map[int64]*InputPhoto) {
	for ,  := range  {
		,  := .AsNotEmpty()
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// NotEmptyToMap collects only NotEmpty constructors to map.
func ( InputPhotoClassArray) () map[int64]*InputPhoto {
	 := make(map[int64]*InputPhoto, len())
	.FillNotEmptyMap()
	return 
}

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

	return 
}

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

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

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

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

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

// InputPhotoArray is adapter for slice of InputPhoto.
type InputPhotoArray []InputPhoto

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// SortByID sorts slice of InputPhoto by ID.
func ( InputPhotoArray) () InputPhotoArray {
	return .Sort(func(,  InputPhoto) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of InputPhoto by ID.
func ( InputPhotoArray) () InputPhotoArray {
	return .SortStable(func(,  InputPhoto) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( InputPhotoArray) ( map[int64]InputPhoto) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( InputPhotoArray) () map[int64]InputPhoto {
	 := make(map[int64]InputPhoto, len())
	.FillMap()
	return 
}