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 ); \
90#define MR_VECTOR_IMPL( Type ) MR_VECTOR_LIKE_IMPL( MR_CONCAT( Vector, Type ), Type )
92#define VECTOR_WRAPPER( Type ) vector_wrapper<typename Type::value_type>
93#define VECTOR_REF_WRAPPER( Type ) vector_ref_wrapper<typename Type::value_type>
95#define REGISTER_VECTOR_LIKE( ClassName, Type ) \
96ADD_AUTO_CAST( ClassName, vector_ref_wrapper<Type> ); \
97ADD_AUTO_CAST( vector_ref_wrapper<Type>, ClassName ); \
98ADD_AUTO_CAST( vector_wrapper<Type>, ClassName );
100#define REGISTER_VECTOR( Type ) \
101ADD_AUTO_CAST( MR_CONCAT( MR, Type ), VECTOR_REF_WRAPPER( Type ) ); \
102ADD_AUTO_CAST( VECTOR_REF_WRAPPER( Type ), MR_CONCAT( MR, Type ) ); \
103ADD_AUTO_CAST( VECTOR_WRAPPER( Type ), MR_CONCAT( MR, Type ) );
105#define VECTOR( ... ) vector_ref_wrapper( __VA_ARGS__ )
107#define NEW_VECTOR( ... ) new vector_wrapper( __VA_ARGS__ )
109#define RETURN_VECTOR( ... ) return auto_cast( VECTOR( __VA_ARGS__ ) )
111#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:19
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