func InsertMany[T any](a *[]T, i int, elems ...T) {
	if n := len(*a) + len(elems); n <= cap(*a) {
		*a = (*a)[:n]
		copy((*a)[i+len(elems):], (*a)[i:i+len(elems)+1])
		copy((*a)[i:], elems)
		return
	}

	s2 := make([]T, len(*a)+len(elems))
	copy(s2, (*a)[:i])
	copy(s2[i:], elems)
	copy(s2[i+len(elems):], (*a)[i:])
	*a = s2
}
// InsertMany inserts elems into a at index i.
//
// NOTE: the implementation of this method is different from that in SliceTricks itself. This implementation
// is optimised for doing the insertion in-place.
InsertMany inserts elems into a at index i.

the implementation of this method is different from that in SliceTricks itself. This implementation
is optimised for doing the insertion in-place.
// InsertMany inserts elems into a at index i . // // NOTE : the implementation of this method is different from that in SliceTricks itself . This implementation // is optimised for doing the insertion in - place .
func InsertMany[T any](a *[]T, i int, elems ...T) {
	if n := len(*a) + len(elems); n <= cap(*a) {
		*a = (*a)[:n]
		copy((*a)[i+len(elems):], (*a)[i:i+len(elems)+1])
		copy((*a)[i:], elems)
		return
	}
	s2 := make([]T, len(*a)+len(elems))
	copy(s2, (*a)[:i])
	copy(s2[i:], elems)
	copy(s2[i+len(elems):], (*a)[i:])
	*a = s2
}
func InsertMany [ T any ] ( a * [ ] T , i int , elems ... T ) { if n := len ( * a ) + len ( elems ) ; n <= cap ( * a ) { * a = ( * a ) [ : n ] copy ( ( * a ) [ i + len ( elems ) : ] , ( * a ) [ i : i + len ( elems ) + 1 ] ) copy ( ( * a ) [ i : ] , elems ) return } s2 := make ( [ ] T , len ( * a ) + len ( elems ) ) copy ( s2 , ( * a ) [ : i ] ) copy ( s2 [ i : ] , elems ) copy ( s2 [ i + len ( elems ) : ] , ( * a ) [ i : ] ) * a = s2 }
InsertMany inserts elems into a at index i.
InsertMany inserts elems into a at index i .