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

// NotifyPeerClassArray is adapter for slice of NotifyPeerClass.
type NotifyPeerClassArray []NotifyPeerClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsNotifyPeer returns copy with only NotifyPeer constructors.
func ( NotifyPeerClassArray) () ( NotifyPeerArray) {
	for ,  := range  {
		,  := .(*NotifyPeer)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsNotifyForumTopic returns copy with only NotifyForumTopic constructors.
func ( NotifyPeerClassArray) () ( NotifyForumTopicArray) {
	for ,  := range  {
		,  := .(*NotifyForumTopic)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// NotifyPeerArray is adapter for slice of NotifyPeer.
type NotifyPeerArray []NotifyPeer

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// NotifyForumTopicArray is adapter for slice of NotifyForumTopic.
type NotifyForumTopicArray []NotifyForumTopic

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}