Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-10-06 15:36:03


On Saturday 06 October 2001 02:27, you wrote:
> Hi guys,
> I am using boost 1.25.0 on a platform (linux/ egcs 1.1.2) that does not
> provide std::allocator. The function library seems to be protected
> against this defect as it makes liberal use of the macro
> BOOST_NO_STD_ALLOCATOR. Unfortunately, even if I define the macro, I get
> a compilation error in function_template.hpp at line 420 (there is a
> similar construct at function.hpp:58)
> template<
> typename R BOOST_FUNCTION_COMMA
> BOOST_FUNCTION_TEMPLATE_PARMS,
> typename Policy = empty_function_policy,
> typename Mixin = empty_function_mixin,
> typename Allocator = std::allocator<function_base> <<<<<<<<<here
>
> class BOOST_FUNCTION_FUNCTION : public function_base, public Mixin
>
> the error is obvious, but I haven't been able to ifdef my way out of it.
>
> Can the authors/experts suggest a workaround or should I just give up
> using the function library?

I don't currently have access to egcs-1.1.2, but it is possible that the
function library will work if "std::allocator<function_base>" to "void" (when
BOOST_NO_STD_ALLOCATOR is defined). I just checked an updated version into
CVS, but essentially I just added:

#ifndef BOOST_NO_STD_ALLOCATOR
# define BOOST_FUNCTION_DEFAULT_ALLOCATOR std::allocator<function_base>
#else
# define BOOST_FUNCTION_DEFAULT_ALLOCATOR void
#endif // BOOST_NO_STD_ALLOCATOR

to function_template.hpp, along with an
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR

at the end. Then replaced "std::allocator<function_base>" with
"BOOST_FUNCTION_DEFAULT_ALLOCATOR"

I'd be interested to know if this fixes function on egcs-1.1.2.

        Doug


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