Table of Contents

Method CreateByFunc

Namespace
Zyl.VectorTraits
Assembly
VectorTraits.dll

CreateByFunc<T>(Func<int, T>)

Creates a new Vector<T> from a from the given Func<T, TResult> (从给定 Func<T, TResult> 创建一个新的 Vector<T> ) .

public static Vector<T> CreateByFunc<T>(Func<int, T> func) where T : struct

Parameters

func Func<int, T>

A function that gets the value of each element (获取每个元素值的函数). Prototype: T func(int index), index is element index.

Returns

Vector<T>

A new Vector<T> from a from the given Func<T, TResult> (一个新Vector<T>,其元素来 Func<T, TResult>).

Type Parameters

T

The vector element type (向量中的元素的类型).

CreateByFunc<T, TUserdata>(Func<int, TUserdata, T>, TUserdata)

Creates a new Vector<T> from a from the given Func<T1, T2, TResult> (从给定 Func<T1, T2, TResult> 创建一个新的 Vector<T> ) .

public static Vector<T> CreateByFunc<T, TUserdata>(Func<int, TUserdata, T> func, TUserdata userdata) where T : struct

Parameters

func Func<int, TUserdata, T>

A function that gets the value of each element (获取每个元素值的函数). Prototype: T func(int index, TUserdata userdata), index is element index.

userdata TUserdata

The userdata (用户自定义数据).

Returns

Vector<T>

A new Vector<T> from a from the given Func<T1, T2, TResult> (一个新Vector<T>,其元素来 Func<T1, T2, TResult>).

Type Parameters

T

The vector element type (向量中的元素的类型).

TUserdata

Type of userdata (userdata的类型).