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

// ExportedChatInviteClassArray is adapter for slice of ExportedChatInviteClass.
type ExportedChatInviteClassArray []ExportedChatInviteClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsChatInviteExported returns copy with only ChatInviteExported constructors.
func ( ExportedChatInviteClassArray) () ( ChatInviteExportedArray) {
	for ,  := range  {
		,  := .(*ChatInviteExported)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// ChatInviteExportedArray is adapter for slice of ChatInviteExported.
type ChatInviteExportedArray []ChatInviteExported

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// SortByDate sorts slice of ChatInviteExported by Date.
func ( ChatInviteExportedArray) () ChatInviteExportedArray {
	return .Sort(func(,  ChatInviteExported) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of ChatInviteExported by Date.
func ( ChatInviteExportedArray) () ChatInviteExportedArray {
	return .SortStable(func(,  ChatInviteExported) bool {
		return .GetDate() < .GetDate()
	})
}