Using boost::mpl, I can create a typedef of a three element vector like follows:
typedef boost::mpl::vector_c<int,1,2,3> height_t;
I can pull the values out of this typedef with the following snippit:
std::vector<int> height;
boost::mpl::for_each<height_t>(boost::bind(&std::vector<int>::push_back, &height, _1));
assert(height[0] == 1);
assert(height[1] == 2);
assert(height[2] == 3);
I'm wondering if there is a way to do this same thing but with a normal 'C' array instead of a std::vector
. Unfortunately, I can't use STL containers in this project.
uint32_t height[3];
boost::mpl::for_each<height_t>(????, &height, _1));
I suspect that I need to replace the ???? with another bind clause. Any ideas?