Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2006-01-14 08:20:04


"Cromwell Enage" <sponage_at_[hidden]> wrote

> I'm also studying file iteration so I can see if that
> helps me out.

File iteration works good with typeof, and you don't have to explicitly
specify IDs. The only problem -- you can't use the file iteration in a
macro.

> > (OTOH, I am thinking of adopting the same strategy,
> so that
> > people don't have re-entrancy problems when using
> typeof.)
>
> Please do adopt this strategy. Currently this kind of
> code doesn't work:
>
> BOOST_TYPEOF_REGISTER_TYPE(
                                                       ^^^^^
> boost::mpl::math::string_c_to_double
> , BOOST_MPL_PP_ARG_SEQ(unsigned char, 40)
> )
>
> BOOST_MPL_PP_ARG_SEQ uses BOOST_PP_REPEAT to create a
> sequence of N elements containing the specified
> primitive integral type.

Do you mean BOOST_TYPEOF_REGISTER_TEMPLATE? I am not sure REPEAT is a
problem here. The following example works (vc71):

----------------
#define BOOST_TYPEOF_COMPLIANT
#include <boost/typeof/typeof.hpp>

template<int n, short m> class x
{};

#define seq (int)(short)
#define MACRO(z, n, text) (BOOST_PP_SEQ_ELEM(n, text))
BOOST_TYPEOF_REGISTER_TEMPLATE(x,
    BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(seq), MACRO, seq))

typedef BOOST_TYPEOF((x<1, 2>())) type;
type y;

int main()
{}
-----------------

Regards,
Arkadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk