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

// UserProfilePhotoClassArray is adapter for slice of UserProfilePhotoClass.
type UserProfilePhotoClassArray []UserProfilePhotoClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsUserProfilePhoto returns copy with only UserProfilePhoto constructors.
func ( UserProfilePhotoClassArray) () ( UserProfilePhotoArray) {
	for ,  := range  {
		,  := .(*UserProfilePhoto)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

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

	return 
}

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

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

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

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

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

// UserProfilePhotoArray is adapter for slice of UserProfilePhoto.
type UserProfilePhotoArray []UserProfilePhoto

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}