|
Boost Users : |
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-07-10 17:59:14
Hello,
I'm a beginer with the preprocessor library. My goal is to generate from a
sequence (a)(b)(c) => a::b::c and from (a) => a
I have tried with the following code
#include <boost/preprocessor/seq/fold_left.hpp>
#include <boost/preprocessor/seq/head.hpp>
#include <boost/preprocessor/seq/tail.hpp>
#define NAME(s, state, x) state::x
BOOST_PP_SEQ_FOLD_LEFT(NAME, BOOST_PP_SEQ_HEAD((a)(b)),
BOOST_PP_SEQ_TAIL((a)(b)))
BOOST_PP_SEQ_FOLD_LEFT(NAME, BOOST_PP_SEQ_HEAD((a)),
BOOST_PP_SEQ_TAIL((a)))
It works well with sequences with more than 1 element but with a sequence
with only an element it fails, having the following preprocessor output
(error?)
a::b
test.cpp:8:1: macro "BOOST_PP_SEQ_ELEM_III" requires 2 arguments, but only 1
given a::BOOST_PP_SEQ_ELEM_III
What I'm missing?
Thanks in advance,
Vicente
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net