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

// ForumTopicClassArray is adapter for slice of ForumTopicClass.
type ForumTopicClassArray []ForumTopicClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// SortByID sorts slice of ForumTopicClass by ID.
func ( ForumTopicClassArray) () ForumTopicClassArray {
	return .Sort(func(,  ForumTopicClass) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of ForumTopicClass by ID.
func ( ForumTopicClassArray) () ForumTopicClassArray {
	return .SortStable(func(,  ForumTopicClass) bool {
		return .GetID() < .GetID()
	})
}

// FillForumTopicDeletedMap fills only ForumTopicDeleted constructors to given map.
func ( ForumTopicClassArray) ( map[int]*ForumTopicDeleted) {
	for ,  := range  {
		,  := .(*ForumTopicDeleted)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// ForumTopicDeletedToMap collects only ForumTopicDeleted constructors to map.
func ( ForumTopicClassArray) () map[int]*ForumTopicDeleted {
	 := make(map[int]*ForumTopicDeleted, len())
	.FillForumTopicDeletedMap()
	return 
}

// AsForumTopicDeleted returns copy with only ForumTopicDeleted constructors.
func ( ForumTopicClassArray) () ( ForumTopicDeletedArray) {
	for ,  := range  {
		,  := .(*ForumTopicDeleted)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillForumTopicMap fills only ForumTopic constructors to given map.
func ( ForumTopicClassArray) ( map[int]*ForumTopic) {
	for ,  := range  {
		,  := .(*ForumTopic)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// ForumTopicToMap collects only ForumTopic constructors to map.
func ( ForumTopicClassArray) () map[int]*ForumTopic {
	 := make(map[int]*ForumTopic, len())
	.FillForumTopicMap()
	return 
}

// AsForumTopic returns copy with only ForumTopic constructors.
func ( ForumTopicClassArray) () ( ForumTopicArray) {
	for ,  := range  {
		,  := .(*ForumTopic)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// ForumTopicDeletedArray is adapter for slice of ForumTopicDeleted.
type ForumTopicDeletedArray []ForumTopicDeleted

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// SortByID sorts slice of ForumTopicDeleted by ID.
func ( ForumTopicDeletedArray) () ForumTopicDeletedArray {
	return .Sort(func(,  ForumTopicDeleted) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of ForumTopicDeleted by ID.
func ( ForumTopicDeletedArray) () ForumTopicDeletedArray {
	return .SortStable(func(,  ForumTopicDeleted) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( ForumTopicDeletedArray) ( map[int]ForumTopicDeleted) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( ForumTopicDeletedArray) () map[int]ForumTopicDeleted {
	 := make(map[int]ForumTopicDeleted, len())
	.FillMap()
	return 
}

// ForumTopicArray is adapter for slice of ForumTopic.
type ForumTopicArray []ForumTopic

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// SortByID sorts slice of ForumTopic by ID.
func ( ForumTopicArray) () ForumTopicArray {
	return .Sort(func(,  ForumTopic) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of ForumTopic by ID.
func ( ForumTopicArray) () ForumTopicArray {
	return .SortStable(func(,  ForumTopic) bool {
		return .GetID() < .GetID()
	})
}

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

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

// FillMap fills constructors to given map.
func ( ForumTopicArray) ( map[int]ForumTopic) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( ForumTopicArray) () map[int]ForumTopic {
	 := make(map[int]ForumTopic, len())
	.FillMap()
	return 
}