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

// ChatParticipantsClassArray is adapter for slice of ChatParticipantsClass.
type ChatParticipantsClassArray []ChatParticipantsClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsChatParticipantsForbidden returns copy with only ChatParticipantsForbidden constructors.
func ( ChatParticipantsClassArray) () ( ChatParticipantsForbiddenArray) {
	for ,  := range  {
		,  := .(*ChatParticipantsForbidden)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsChatParticipants returns copy with only ChatParticipants constructors.
func ( ChatParticipantsClassArray) () ( ChatParticipantsArray) {
	for ,  := range  {
		,  := .(*ChatParticipants)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AppendOnlyNotForbidden appends only NotForbidden constructors to
// given slice.
func ( ChatParticipantsClassArray) ( []*ChatParticipants) []*ChatParticipants {
	for ,  := range  {
		,  := .AsNotForbidden()
		if ! {
			continue
		}
		 = append(, )
	}

	return 
}

// AsNotForbidden returns copy with only NotForbidden constructors.
func ( ChatParticipantsClassArray) () ( []*ChatParticipants) {
	return .AppendOnlyNotForbidden()
}

// FirstAsNotForbidden returns first element of slice (if exists).
func ( ChatParticipantsClassArray) () ( *ChatParticipants,  bool) {
	,  := .First()
	if ! {
		return
	}
	return .AsNotForbidden()
}

// LastAsNotForbidden returns last element of slice (if exists).
func ( ChatParticipantsClassArray) () ( *ChatParticipants,  bool) {
	,  := .Last()
	if ! {
		return
	}
	return .AsNotForbidden()
}

// PopFirstAsNotForbidden returns element of slice (if exists).
func ( *ChatParticipantsClassArray) () ( *ChatParticipants,  bool) {
	,  := .PopFirst()
	if ! {
		return
	}
	return .AsNotForbidden()
}

// PopAsNotForbidden returns element of slice (if exists).
func ( *ChatParticipantsClassArray) () ( *ChatParticipants,  bool) {
	,  := .Pop()
	if ! {
		return
	}
	return .AsNotForbidden()
}

// ChatParticipantsForbiddenArray is adapter for slice of ChatParticipantsForbidden.
type ChatParticipantsForbiddenArray []ChatParticipantsForbidden

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// ChatParticipantsArray is adapter for slice of ChatParticipants.
type ChatParticipantsArray []ChatParticipants

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}