Boost logo

Boost Users :

Subject: [Boost-users] [Parameter] abstract base class
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2010-09-15 15:15:24


I have a design in which I must inherit from a class with a whole lot of
construction parameters. I need to have a pure virtual function in the
class that inherits from this thing and is then provided by subclasses.
Since the classes in question must all accept this huge list of
construction parameters I would like to use named parameters.
Unfortunately there's a problem caused by the attempt to create a
function pointer declaration that takes the base class by value.

I don't really understand why this is going on. Instead of just calling
the base's constructor directly, the BOOST_PARAMETER_CONSTRUCTOR macro
creates a type resolution instantiation with this:

boost::parameter::aux::unaryfunptr_arg_type< void(*)(B) >::type

'B' being the base class.

This explodes if B is an abstract class. Both g++ 3.4.5 (mingw) and
VS2010 hate this line.

Before I go about attempting to devise a workaround, what is the purpose
of this strange bit of code? Why not just use 'B' directly?? The type
resolution metafunction simply returns the 'B' place argument as its
type anyway...

I note some weird workaround code for ancient versions of MSVC but they
seem to be created to make this type resolution thing work, not because
'B' is not known or something. However, I figure the people who wrote
this library are smarter and more knowlegeable than I so the fact that I
see no need for this code is probably my problem and not a reflection of
it being unnecessary.

-- 
http://crazyeddiecpp.blogspot.com/

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