[prev in list] [next in list] [prev in thread] [next in thread]
List: boost
Subject: [boost] iterative type registration with typeof
From: "Arkadiy Vertleyb" <vertleyb () hotmail ! com>
Date: 2005-12-30 4:01:41
Message-ID: dp2b3t$rnj$1 () sea ! gmane ! org
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic