Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-01-29 15:06:09


----- Original Message -----
From: Yitzhak Sapir <ysapir_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, January 29, 2002 4:51 PM
Subject: RE: [boost] boost bind/functional/reference wrapper/mem_fn

> [snipped]
>
> 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.
>
FWIW, I've solved this 'precompiled header' problem in my own copy of the
bind library by replacing the global variables with inline functions:
That is, I did this:

namespace
{
    /*
    boost::_bi::arg<1> _1;
    boost::_bi::arg<2> _2;
    boost::_bi::arg<3> _3;
    boost::_bi::arg<4> _4;
    boost::_bi::arg<5> _5;
    boost::_bi::arg<6> _6;
    boost::_bi::arg<7> _7;
    boost::_bi::arg<8> _8;
    boost::_bi::arg<9> _9;
    */

    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 change implies that I can't write bind(foo,_1) but bind(foo,_1()).
Just a small syntatic difference IMO.

But unfortunately, such a change, even it if were appropriate, would break
existing code.
However, it might help you to get through until a definitive solution is
found.

BTW, I did the same with 'ignore' in the tuples library.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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