I wish to add a bunch of objects of this type to a std::vector.
typedef struct
{
int handle;
} Handle;
Handle is defined within a C API header which I am unable to change.
I’m doing this at the moment but am wondering if it can be done as a one-liner.
Handle handle1 = {12};
Handle handle2 = {13};
std::vector<Handle> handles = boost::assign::list_of(handle1)(handle2);
I using a C++98 compiler.
Just write a
make_handlefunction: