c++ - Adding std::vector<bool> to a Variant of Containers -


i'm wrapping c interface has load function returning value* object, points dynamic array of value objects:

typedef struct value {     union {         int8_t   i8;         int16_t  i16;         int32_t  i32;         int64_t  i64;         bool     b;     } value; } value_t; 

the objects in given array of same type.

my idea represent follows in c++:

typedef boost::variant<std::vector<bool>, std::vector<int8_t>, std::vector<int16_t>, std::vector<int32_t>, std::vector<int64_t>, std::vector<std::string> > container; 

is reasonable , pitfalls should aware of? can there compiler specific issues regarding how bool defined? realize std::vector represented internally using bits , there additional issues in regard.

i'm working c++98 compilers.

since you're using boost, it's best use boost::containers::vector<bool>. container have behavior want.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -