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

// ContactsTopPeersClassArray is adapter for slice of ContactsTopPeersClass.
type ContactsTopPeersClassArray []ContactsTopPeersClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsContactsTopPeers returns copy with only ContactsTopPeers constructors.
func ( ContactsTopPeersClassArray) () ( ContactsTopPeersArray) {
	for ,  := range  {
		,  := .(*ContactsTopPeers)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// ContactsTopPeersArray is adapter for slice of ContactsTopPeers.
type ContactsTopPeersArray []ContactsTopPeers

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}