Boost logo

Boost :

From: Yitzhak Sapir (ysapir_at_[hidden])
Date: 2002-01-30 09:39:47


The talk of inline functions gave me an idea. How about doing something
like this as a workaround:
template<class A1> class list1
{
public:
[...]
    BOOST_BIND_INLINE A1 operator[] (arg<1>) const { return a1_; }
    BOOST_BIND_INLINE A1 operator[] (arg<1>(*)()) const { return a1_; }
[..] (same for all lists)

[...]
template<int I> struct add_value< arg<I> >
{
    typedef arg<I> type;
};

template<int I> struct add_value< arg<I>(*)() >
{
    typedef arg<I> type;
};
[...]
template<int I> BOOST_BIND_INLINE _avt_r1 _avt_f(arg<I>);
template<int I> BOOST_BIND_INLINE _avt_r1 _avt_f(arg<I>(*)());
[...]
namespace
{
    inline boost::_bi::arg<1> _1() { return boost::_bi::arg<1>(); };
    inline boost::_bi::arg<2> _2() { return boost::_bi::arg<2>(); };
    inline boost::_bi::arg<3> _3() { return boost::_bi::arg<3>(); };
    inline boost::_bi::arg<4> _4() { return boost::_bi::arg<4>(); };
    inline boost::_bi::arg<5> _5() { return boost::_bi::arg<5>(); };
    inline boost::_bi::arg<6> _6() { return boost::_bi::arg<6>(); };
    inline boost::_bi::arg<7> _7() { return boost::_bi::arg<7>(); };
    inline boost::_bi::arg<8> _8() { return boost::_bi::arg<8>(); };
    inline boost::_bi::arg<9> _9() { return boost::_bi::arg<9>(); };
}

This way it can remain one header with no extra defines based on whether
you want/don't want precompiled headers. Or is something wrong with
this code?

-----Original Message-----
From: Peter Dimov [mailto:pdimov_at_[hidden]]
Sent: Wednesday, January 30, 2002 1:33 PM
To: boost_at_[hidden]
Subject: Re: [boost] boost bind/functional/reference wrapper/mem_fn

> The problem is not related to libraries as I first suspected (although
> the linkage of the library is the first place it shows up), but rather
> to precompiled headers. This is the default for newly created
projects
> in MSVC usually. It is not documented that bind cannot be used in
> precompiled headers. It is for this failure to compile that I asked
> that they be macros.

I've moved the placeholders to their own header,
boost/bind/placeholders.hpp. bind.hpp now includes this header unless
BOOST_BIND_NO_PLACEHOLDERS is defined. The placeholders are now of type
boost::arg<N> (they were of type boost::_bi::arg<N>); arg<> is defined
in
boost/bind/arg.hpp.

Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/


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