From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2004-09-21 15:08:56
----- Mensaje original -----
De: Thorsten Ottosen <nesotto_at_[hidden]>
Fecha: Martes, Septiembre 21, 2004 9:03 pm
Asunto: [boost] Re: [assign] fixes for msvc, msvc-stlport and vc7
> Hi Joaquin,
> | 2. list_insert::operator()(T t) has been changed to accept
> | a const reference instead.
> I have made this change as
> #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
> template< class T >
> list_inserter& operator()( const T& t )
> template< class T >
> list_inserter& operator()( T t )
As you wrote it, the workaround applies only to
MSVC 6.0. Let's wait for the next test cycle to see
if it has to be extended to MSVC 7.0 as well.
> | 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" );
Ummm, I see. The fact is that here lies, I think, the reason
for the three remaining crashes, all on calls to multi-argument
versions of list_inserter::operator().
Maybe I'll give this some thinking over if I have some spare
> of course, the Function arg could be const Function&, but is there any
> difference in inline code?
I think this can involve an extra copy under some circumstances,
ans some compilers might not optimize this away. But in general
I agree with you little is gained by having const Function &.
> Muchos gracias for the patch!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk