Random access to sequences
I read up on boost::mpl::at<...>. It's pretty cool, but I wanted to make it
a little easier to use. I found it a little annoying to have to type out
'int_<...>' for the index number, so I created a struct to automate that
feature:
==========================
template
Stephen Gross writes:
I read up on boost::mpl::at<...>. It's pretty cool, but I wanted to make it a little easier to use. I found it a little annoying to have to type out 'int_<...>' for the index number, so I created a struct to automate that feature:
========================== template
struct atIdx { typedef typename boost::mpl::at ::type type; }; ========================== With the struct above, you can do the following:
============================= typedef boost::mpl::vector
t; atIdx ::type i; // This line is shorter than the one below: /* atIdx >::type i; */ ============================= Is this feature already available in boost somewhere? If I've reinvented the wheel, I'll be happy to use an existing implementation...
See http://www.boost.org/libs/mpl/doc/refmanual/at-c.html. -- Aleksey Gurtovoy MetaCommunications Engineering
participants (2)
-
Aleksey Gurtovoy
-
Stephen Gross