Пример #1
0
        public Vector()
        {
            if (!SupportTypes.TryGetValue(typeof(TType), out var type))
            {
                throw new NotSupportedException($"{typeof(TType).Name} does not support");
            }

            this._VectorElementTypes = type;
            this._ElementType        = type.ToNativeVectorElementType();

            this._Imp = this.CreateVectorImp(this._ElementType);

            this.NativePtr = Dlib.Native.vector_new(this._ElementType);
        }
Пример #2
0
        internal Vector(IntPtr ptr, bool isEnabledDispose = true)
            : base(isEnabledDispose)
        {
            if (ptr == IntPtr.Zero)
            {
                throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr));
            }

            if (!SupportTypes.TryGetValue(typeof(TType), out var type))
            {
                throw new NotSupportedException($"{typeof(TType).Name} does not support");
            }

            this.NativePtr = ptr;

            this._VectorElementTypes = type;
            this._ElementType        = type.ToNativeVectorElementType();

            this._Imp = this.CreateVectorImp(this._ElementType);

            this.NativePtr = ptr;
        }