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

// DialogPeerClassArray is adapter for slice of DialogPeerClass.
type DialogPeerClassArray []DialogPeerClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsDialogPeer returns copy with only DialogPeer constructors.
func ( DialogPeerClassArray) () ( DialogPeerArray) {
	for ,  := range  {
		,  := .(*DialogPeer)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsDialogPeerFolder returns copy with only DialogPeerFolder constructors.
func ( DialogPeerClassArray) () ( DialogPeerFolderArray) {
	for ,  := range  {
		,  := .(*DialogPeerFolder)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// DialogPeerArray is adapter for slice of DialogPeer.
type DialogPeerArray []DialogPeer

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// DialogPeerFolderArray is adapter for slice of DialogPeerFolder.
type DialogPeerFolderArray []DialogPeerFolder

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}