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

// ChannelLocationClassArray is adapter for slice of ChannelLocationClass.
type ChannelLocationClassArray []ChannelLocationClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsChannelLocation returns copy with only ChannelLocation constructors.
func ( ChannelLocationClassArray) () ( ChannelLocationArray) {
	for ,  := range  {
		,  := .(*ChannelLocation)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

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

	return 
}

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

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

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

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

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

// ChannelLocationArray is adapter for slice of ChannelLocation.
type ChannelLocationArray []ChannelLocation

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}