18 operator const std::vector<T>&()
const
23 operator std::vector<T>&()
50 :
base( new std::vector<T>( std::move( vec ) ) )
70 :
base( const_cast<std::vector<T>*>( &vec ) )
79#define MR_VECTOR_LIKE_IMPL( ClassName, Type ) \
80static_assert( sizeof( MR_CONCAT( MR, ClassName ) ) == sizeof( vector_ref_wrapper<Type> ) ); \
81void MR_CONCAT( MR_CONCAT( mr, ClassName ), Invalidate )( MR_CONCAT( MR, ClassName )* vec ) \
83 reinterpret_cast<vector_ref_wrapper<Type>*>( vec )->invalidate(); \
85void MR_CONCAT( MR_CONCAT( mr, ClassName ), Free )( MR_CONCAT( MR, ClassName )* vec ) \
87 delete reinterpret_cast<vector_wrapper<Type>*>( vec ); \
89MR_CONCAT( MR, ClassName )* MR_CONCAT( MR_CONCAT( mr, ClassName ), New )(void) \
91 return reinterpret_cast<MR_CONCAT( MR, ClassName )*>( new vector_wrapper<Type>( std::vector<Type>() ) ); \
94#define MR_VECTOR_IMPL( Type ) MR_VECTOR_LIKE_IMPL( MR_CONCAT( Vector, Type ), Type )
96#define VECTOR_WRAPPER( Type ) vector_wrapper<typename Type::value_type>
97#define VECTOR_REF_WRAPPER( Type ) vector_ref_wrapper<typename Type::value_type>
99#define REGISTER_VECTOR_LIKE( ClassName, Type ) \
100ADD_AUTO_CAST( ClassName, vector_ref_wrapper<Type> ); \
101ADD_AUTO_CAST( vector_ref_wrapper<Type>, ClassName ); \
102ADD_AUTO_CAST( vector_wrapper<Type>, ClassName );
104#define REGISTER_VECTOR( Type ) \
105ADD_AUTO_CAST( MR_CONCAT( MR, Type ), VECTOR_REF_WRAPPER( Type ) ); \
106ADD_AUTO_CAST( VECTOR_REF_WRAPPER( Type ), MR_CONCAT( MR, Type ) ); \
107ADD_AUTO_CAST( VECTOR_WRAPPER( Type ), MR_CONCAT( MR, Type ) );
109#define VECTOR( ... ) vector_ref_wrapper( __VA_ARGS__ )
111#define NEW_VECTOR( ... ) new vector_wrapper( __VA_ARGS__ )
113#define RETURN_VECTOR( ... ) return auto_cast( VECTOR( __VA_ARGS__ ) )
115#define RETURN_NEW_VECTOR( ... ) return auto_cast( NEW_VECTOR( __VA_ARGS__ ) )
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
vector_ref_wrapper(const MR::Vector< T, I > &vec)
Definition Vector.h:74
vector_ref_wrapper(const std::vector< T > &vec)
Definition Vector.h:69
value_type * data
Definition Vector.h:15
T value_type
Definition Vector.h:13
vector_wrapper_base(std::vector< T > *vec)
Definition Vector.h:35
std::vector< T > * vec_
Definition Vector.h:41
void invalidate()
Definition Vector.h:28
size_t size
Definition Vector.h:16
vector_wrapper(std::vector< T > &&vec)
Definition Vector.h:49
vector_wrapper(MR::Vector< T, I > &&vec)
Definition Vector.h:54
~vector_wrapper()
Definition Vector.h:58