Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-09-21 14:03:03

Hi Joaquin,

|"Joaquín Mª López Muñoz" <joaquin_at_[hidden]> wrote in message
|The attached fix makes all tests compile for msvc (not
|all run, though) and hopefully also for the other two toolsets
|(can't try myself.) Two changes applied, both in

wow! great work :-)

|1. MSVC++ 6.0/7.0, in the presence of a templated
|memfuns, interprets additional overloads as if they were
|specializations of the former (which is not legal C++,
|AFAIK). This introduces problems with the copy ctors
|of list_insert, which can be workarounded by
| a) making the template copy ctor accept const references
| b) declaring and defining the plain default copy ctor of
| list_insert *after* the templated copy ctor.

ok, this should not be a problem to do.

Amazing how simple it is to write non-portable code :-)

| 2. list_insert::operator()(T t) has been changed to accept
| a const reference instead.

I have made this change as


        template< class T >
        list_inserter& operator()( const T& t )
        template< class T >
        list_inserter& operator()( T t )

| With these changes, all tests build, though three of them
| crash at run-time (list_inserter, list_of and multi_index_container)

ok, this is much better than before! some of the test a big and fat and do
some tricky conversions...but just having the
basic stuff working is great!

|I've got two questions:
|1. Could somebody (the author, I guess) validate these changes
|for commit?

I have comitted them.

|2. list_inserter follows a strange convention (IMHO) of not
|forcing template params to be const references in its various
|copy ctors and assignment operators, for instance:
|list_inserter( Function fun );
|template< class T >
|list_inserter& operator=( T r );
|Any reason for this approach? I don't know if this can pose
|problems, but to me having these qualified with const & seems
|like the usual way.

yes, the bitches are char[N] and wchar_t[N] which does not convert to char*
and wchar_t* otherwise. this comes up in simple stuff like

vector<string> = list_of( "foo" )( "goobar" );

of course, the Function arg could be const Function&, but is there any
difference in inline code?

Muchos gracias for the patch!


Boost list run by bdawes at, gregod at, cpdaniel at, john at