Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-26 12:19:14


AMDG

Kevin Jenkins wrote:
> How do I do this? Is there a way to make the boost::fusion vector hold
> references instead of copies? Or hold pointers?

Use boost::ref and/or vector_tie to make it hold references.

#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/include/vector_tie.hpp>
#include <boost/fusion/include/push_back.hpp>
#include <boost/ref.hpp>

class DoNotCopyConstructMe {
public:
   DoNotCopyConstructMe() {}
private:
   DoNotCopyConstructMe(const DoNotCopyConstructMe &ref) {}
};

int main() {
    DoNotCopyConstructMe var1,var2,var3,var4;
    boost::fusion::push_back(boost::fusion::vector_tie(var1, var2,
var3),boost::ref(var4));
}

In Christ,
Steven Watanabe


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