|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-12-29 23:01:41
An alternative approach to ones discussed earlier would be to use file
iteration, such as:
main.cpp-----------------------------------
#define BOOST_TYPEOF_COMPLIANT
#include <boost/typeof/typeof.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::mpl::vector<>)
BOOST_TYPEOF_REGISTER_TYPE(boost::mpl::vector0<>)
# define BOOST_PP_ITERATION_LIMITS (1, 10)
# define BOOST_PP_FILENAME_1 "register_mpl.hpp"
# include BOOST_PP_ITERATE()
int main()
{
boost::mpl::vector1<boost::mpl::vector<int, boost::mpl::vector0<> > > v;
typedef BOOST_TYPEOF(v) v_type;
return 0;
}
register_mpl.hpp--------------------------------------------
#include <boost/typeof/typeof.hpp>
#define n BOOST_PP_ITERATION()
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::vector, n)
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_PP_CAT(boost::mpl::vector, n), n)
#undef n
--------------
This approach can be also applied to sequences.
It would work with the current typeof.
Regards,
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk