Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2006-08-09 10:34:10


On Aug 9, 2006, at 10:17 PM, Thorsten Ottosen wrote:

> Stephen Hewitt <shewitt.au <at> gmail.com> writes:
>
>>
>> I originally posted this message in Boost-users but I think Boost-
>> developers
>> is probably more suitable. It regards a non-standard extension
>> which I think
>> is being used in Boost.Serialization. I have mailed the author (and
>> Boost-users) but he feels the construct is legal.
>
> I think you have to change it a little to make it legal:
>
>> The "make_nvp" function looks like as follows:
>> [CODE]
>> nvp<T> make_nvp(const char * name, T & t){
>> return nvp<T>(name, t);
>> }
>> [/CODE]
>
> If the return type is "const vnp<T>" it should work.
>
> I'm wondering why the orginal code compiles on other compilers.

Actually the code in the CVS is:

template<class T>
inline
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
const
#endif
nvp<T> make_nvp(const char * name, T & t){
     return nvp<T>(name, t);
}

The const is omitted only on some nonconforming compilers such as
MSVC 6.

Matthias


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