Boost logo

Boost :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-07-09 20:02:43


On Wed, Jul 9, 2008 at 5:34 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:

> I have the following exported factory function in a DLL I'm building on
> Windows:
>
> extern "C" void BOOST_EXTENSION_EXPORT_DECL
> export_aspects( boost::extensions::factory_map& fm )
> {
> using namespace vfx::aspects;
> using namespace vfx::messenger;
>
> fm.get<Aspect, MessageReader&, unsigned int>()[0].set<Appearance>();
> fm.get<Aspect, MessageReader&, unsigned int>()[1].set<Health>();
> }
>
> As you can see, I am specifying that each class accepts a single
> construction parameter- a reference to a MessageReader object. However, this
> isn't compiling because I don't think that it likes reference types. How can
> I specify that the constructor takes a reference? boost::ref? I would post
> the compiler warnings & errors I'm getting, however they're exceedingly
> large. Most of the warnings and errors are coming from std::map, basically
> complaining that it's trying to create a map of reference types, which can't
> possibly work. Help is appreciated.
>
> As an unrelated note, I would really like to see the template parameters
> cleaned up. There's at least 5 places I've had to redundantly specify the
> same 3 template parameters (like in the example above). I already brought
> this up in another thread, but I can't tell you how important it is. If I
> ever change the number of construction parameters my Appearance or Health
> classes take (mapped above), I will have to shift through 5 or more files
> simply to adjust all of the template parameters to make everything compile.
>

Never mind, I had a flaw in my code. The "unsigned int" and "MessageReader&"
template parameters are in the wrong spots, they need to be swapped. This
fixes everything. Sorry for the confusion!


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