|
Boost Users : |
Subject: [Boost-users] [fusion] Use of FUSION_MAX_VECTOR_SIZE in headers
From: Gabriel Redner (gredner_at_[hidden])
Date: 2010-02-09 17:49:04
Hi all,
I'm trying to use fusion vectors with more than 10 elements, but I'm
running into some trouble.
I'm using fusion as an implementation detail of some header-based
tools, which get included (often indirectly) by some translation
units. The tools require large fusion vectors, but I don't want
client code (i.e. the .cpp files) to have to care about this. I was
under the impression that I could just add:
#define FUSION_MAX_VECTOR_SIZE 20
#include <boost/fusion/container.hpp>
in my tool's header file, and be off to the races. It seems that this
works only if no other fusion header has been included previously in
the same translation unit:
#include <boost/fusion/container.hpp>
...
#define FUSION_MAX_VECTOR_SIZE 20
#include <boost/fusion/container.hpp>
...
// Error - too many template arguments!
boost::fusion::make_vector(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
I really don't want to have to track down every translation unit which
is (usually indirectly) including my tool's header. I am under the
impression that boost::function is fine with client code redefining
its limit macro and re-including its header, but perhaps fusion does
not have the same feature?
I also realize that for vector itself I can just include vectorN.hpp
and use vectorN<...>, but if I want to use the generation functions
(make_vector, vector_tie) it seems I'm stuck. Is there a workaround,
or just something obvious that I'm doing wrong?
Thanks,
-Gabe
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