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

// PeerLocatedClassArray is adapter for slice of PeerLocatedClass.
type PeerLocatedClassArray []PeerLocatedClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsPeerLocated returns copy with only PeerLocated constructors.
func ( PeerLocatedClassArray) () ( PeerLocatedArray) {
	for ,  := range  {
		,  := .(*PeerLocated)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsPeerSelfLocated returns copy with only PeerSelfLocated constructors.
func ( PeerLocatedClassArray) () ( PeerSelfLocatedArray) {
	for ,  := range  {
		,  := .(*PeerSelfLocated)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// PeerLocatedArray is adapter for slice of PeerLocated.
type PeerLocatedArray []PeerLocated

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// PeerSelfLocatedArray is adapter for slice of PeerSelfLocated.
type PeerSelfLocatedArray []PeerSelfLocated

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}