Markus Werle | 20 Aug 09:21

[tr1] tuple / autoconversion problem

> [ignore this line: it makes gmane stop complaining about top-posting]

Hi!

Trying to migrate existing code from boost::xxx to std::tr1::xxx using
the boost::tr1 implementation for Visual Studio 2005 SP1
In the presence of some exotic autoconversion utility the 
the std::tr1::tuple version of my code fails on vc8. 
The error messages indicate that the conversion operator
is not considered by the compiler.

Below is code that fails to compile on vc8 if USE_TR1 is defined
Do you have an idea how to fix this?

Thanx, Markus

---snip---
#include <boost/tr1/memory.hpp>

#ifdef USE_TR1
  #include <boost/tr1/tuple.hpp>
#else
  #include <boost/tuple/tuple.hpp>
#endif

#include <boost/any.hpp>

#include <iostream>

namespace Core
(Continue reading)

Joel de Guzman | 20 Aug 10:18

Re: [tr1] tuple / autoconversion problem

Markus Werle wrote:
>> [ignore this line: it makes gmane stop complaining about top-posting]
> 
> Hi!
> 
> Trying to migrate existing code from boost::xxx to std::tr1::xxx using
> the boost::tr1 implementation for Visual Studio 2005 SP1
> In the presence of some exotic autoconversion utility the 
> the std::tr1::tuple version of my code fails on vc8. 
> The error messages indicate that the conversion operator
> is not considered by the compiler.

You caught a bug. It's fixed now in SVN trunk. Thanks!

Regards,
--

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
Markus Werle | 20 Aug 11:33

Re: [tr1] tuple / autoconversion problem

Joel de Guzman <joel <at> boost-consulting.com> writes:

> 
> Markus Werle wrote:
> >> [ignore this line: it makes gmane stop complaining about top-posting]
> > 
> > Hi!
> > 
> > Trying to migrate existing code from boost::xxx to std::tr1::xxx using
> > the boost::tr1 implementation for Visual Studio 2005 SP1
> > In the presence of some exotic autoconversion utility the 
> > the std::tr1::tuple version of my code fails on vc8. 
> > The error messages indicate that the conversion operator
> > is not considered by the compiler.
> 
> You caught a bug. It's fixed now in SVN trunk. Thanks!

Wow! 40 minutes from report to fix is another PRO for OpenSource.
Thanks!

And now: although fixed for trunk, I am behind a firewall here,
so I'd like to patch 1_36_0. 
Could you provide the modified files here on the list or at least
name them, so I can fetch them via web-frontend?

best regards, 

Markus
Joel de Guzman | 20 Aug 11:42

Re: [tr1] tuple / autoconversion problem

Markus Werle wrote:
> Joel de Guzman <joel <at> boost-consulting.com> writes:
> 
>> Markus Werle wrote:
>>>> [ignore this line: it makes gmane stop complaining about top-posting]
>>> Hi!
>>>
>>> Trying to migrate existing code from boost::xxx to std::tr1::xxx using
>>> the boost::tr1 implementation for Visual Studio 2005 SP1
>>> In the presence of some exotic autoconversion utility the 
>>> the std::tr1::tuple version of my code fails on vc8. 
>>> The error messages indicate that the conversion operator
>>> is not considered by the compiler.
>> You caught a bug. It's fixed now in SVN trunk. Thanks!
> 
> Wow! 40 minutes from report to fix is another PRO for OpenSource.
> Thanks!
> 
> And now: although fixed for trunk, I am behind a firewall here,
> so I'd like to patch 1_36_0. 
> Could you provide the modified files here on the list or at least
> name them, so I can fetch them via web-frontend?

boost/fusion/tuple/tuple.hpp
boost/fusion/tuple/detail/tuple_expand.hpp

I also added your test to the test suite:

libs/fusion/test/sequence/tr1_tuple_auto_conv.cpp

(Continue reading)

Markus Werle | 20 Aug 12:11

Re: [tr1] tuple / autoconversion problem

Joel de Guzman <joel <at> boost-consulting.com> writes:

> boost/fusion/tuple/tuple.hpp
> boost/fusion/tuple/detail/tuple_expand.hpp
> 

I still get compiler errors in tuple.hpp due to misssing
return type in line 57:

template <typename U1, typename U2>
tuple & // THIS LINE IS MISSING  <-----------------------      
operator=(std::pair<U1, U2> const& rhs)
{
    base_type::operator=(rhs);
    return *this;
}

Very nice compiler you have ;-P. 

Markus 
Joel de Guzman | 20 Aug 14:33

Re: [tr1] tuple / autoconversion problem

Markus Werle wrote:
> Joel de Guzman <joel <at> boost-consulting.com> writes:
> 
>> boost/fusion/tuple/tuple.hpp
>> boost/fusion/tuple/detail/tuple_expand.hpp
>>
> 
> I still get compiler errors in tuple.hpp due to misssing
> return type in line 57:
> 
> template <typename U1, typename U2>
> tuple & // THIS LINE IS MISSING  <-----------------------      
> operator=(std::pair<U1, U2> const& rhs)
> {
>     base_type::operator=(rhs);
>     return *this;
> }
> 
> 
> Very nice compiler you have ;-P. 

Ooops, sorry. That was hastily added.

Regards,
--

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
John Maddock | 20 Aug 10:24

Re: [tr1][fusion] tuple / autoconversion problem

Markus Werle wrote:
>> [ignore this line: it makes gmane stop complaining about top-posting]
>
> Hi!
>
> Trying to migrate existing code from boost::xxx to std::tr1::xxx using
> the boost::tr1 implementation for Visual Studio 2005 SP1
> In the presence of some exotic autoconversion utility the
> the std::tr1::tuple version of my code fails on vc8.
> The error messages indicate that the conversion operator
> is not considered by the compiler.
>
> Below is code that fails to compile on vc8 if USE_TR1 is defined
> Do you have an idea how to fix this?

I confess to being stumped at present: the code compiles with VC9, GCC and 
Intel 10.1, but fails with VC7.1 and VC8 :-(

Not sure if any fusion experts would have any ideas?

John. 
Joel de Guzman | 20 Aug 10:34

Re: [tr1][fusion] tuple / autoconversion problem

John Maddock wrote:
> Markus Werle wrote:
>>> [ignore this line: it makes gmane stop complaining about top-posting]
>>
>> Hi!
>>
>> Trying to migrate existing code from boost::xxx to std::tr1::xxx using
>> the boost::tr1 implementation for Visual Studio 2005 SP1
>> In the presence of some exotic autoconversion utility the
>> the std::tr1::tuple version of my code fails on vc8.
>> The error messages indicate that the conversion operator
>> is not considered by the compiler.
>>
>> Below is code that fails to compile on vc8 if USE_TR1 is defined
>> Do you have an idea how to fix this?
> 
> I confess to being stumped at present: the code compiles with VC9, GCC 
> and Intel 10.1, but fails with VC7.1 and VC8 :-(
> 
> Not sure if any fusion experts would have any ideas?

Fixed. I admit it's a bug. The thing is, fusion tuple adopted the
TR1 interface in essence plus some more extensions to take advantage
of the features fusion provides beyond TR1 (e.g. iterators, algorithms,
sequence compatibility, etc.). The side effect is that corner cases
like this becomes problematic on some compilers.

Solution: conform to TR1 to the letter. No extras. No more, no less.
The downside is that some features (e.g. copy/assign from a fusion
list or view) are *now disabled*. Anyway, if you want a more feature
(Continue reading)

Markus Werle | 20 Aug 12:26

Re: [tr1][fusion] tuple / autoconversion problem

Joel de Guzman <joel <at> boost-consulting.com> writes:

> Fixed. I admit it's a bug. The thing is, fusion tuple adopted the
> TR1 interface in essence plus some more extensions to take advantage
> of the features fusion provides beyond TR1 (e.g. iterators, algorithms,
> sequence compatibility, etc.). The side effect is that corner cases
> like this becomes problematic on some compilers.
> 
> Solution: conform to TR1 to the letter. No extras. No more, no less.
> The downside is that some features (e.g. copy/assign from a fusion
> list or view) are *now disabled*. Anyway, if you want a more feature
> rich implementation, go for the fusion vector.

And this here fails:

#include <boost/assign/list_of.hpp>
#include <boost/assign/list_inserter.hpp>
#include <boost/tr1/tuple.hpp>

#include <list>

int main(int argc, char* argv[])
{
	typedef std::list<std::tr1::tuple<int, std::string> > mod_list_t;

	static mod_list_t const l = 
		boost::assign::tuple_list_of(1, "A")(2, "B"); 

	return 0;
}
(Continue reading)

Joel de Guzman | 20 Aug 14:35

Re: [tr1][fusion] tuple / autoconversion problem

Markus Werle wrote:

> And this here fails:
> 
> #include <boost/assign/list_of.hpp>
> #include <boost/assign/list_inserter.hpp>
> #include <boost/tr1/tuple.hpp>
> 
> #include <list>
> 
> int main(int argc, char* argv[])
> {
> 	typedef std::list<std::tr1::tuple<int, std::string> > mod_list_t;
> 
> 	static mod_list_t const l = 
> 		boost::assign::tuple_list_of(1, "A")(2, "B"); 
> 
> 	return 0;
> }
> 
> 
> Any hint?

I'm not familiar with boost assign. Could you please provide a test
case that does not use boost.assign?

Regards,
--

-- 
Joel de Guzman
http://www.boostpro.com
(Continue reading)

Markus Werle | 20 Aug 15:14

Re: [tr1][fusion] tuple / autoconversion problem

Joel de Guzman <joel <at> boost-consulting.com> writes:

> 
> Markus Werle wrote:
> 
> > And this here fails:
> > 
> > #include <boost/assign/list_of.hpp>
> > #include <boost/assign/list_inserter.hpp>
> > #include <boost/tr1/tuple.hpp>
> > 
> > #include <list>
> > 
> > int main(int argc, char* argv[])
> > {
> > 	typedef std::list<std::tr1::tuple<int, std::string> > mod_list_t;
> > 
> > 	static mod_list_t const l = 
> > 		boost::assign::tuple_list_of(1, "A")(2, "B"); 
> > 
> > 	return 0;
> > }
> > 
> > 
> > Any hint?
> 
> I'm not familiar with boost assign. Could you please provide a test
> case that does not use boost.assign?

Actually I played around with boost::assign and tried to fix this myself.
(Continue reading)

Markus Werle | 20 Aug 15:25

Re: [tr1][fusion] tuple / autoconversion problem

Markus Werle <numerical.simulation <at> web.de> writes:

> Is it hard work and/or useful to make this compile?
> 
> ---snip----
> #include <boost/tr1/tuple.hpp>
> #include <boost/tuple/tuple.hpp>
> 
> #include <string>
> #include <list>
> 
> int main(int argc, char* argv[])
> {
> 	typedef std::list<std::tr1::tuple<int, std::string> > list_t;
> 	typedef std::list<boost::tuple<int, std::string> > b_list_t;
> 
> 	b_list_t bl;
> 	list_t l = bl;
> 
> 	return 0;
> }

Ooops!

Now it is me copyying the wrong stuff, sorry:

int main(int argc, char* argv[])
{
	typedef std::tr1::tuple<int, std::string> tr1_t;
	typedef boost::tuple<int, std::string> b_t;
(Continue reading)

Joel de Guzman | 20 Aug 16:42

Re: [tr1][fusion] tuple / autoconversion problem

Markus Werle wrote:
> Joel de Guzman <joel <at> boost-consulting.com> writes:
> 
>> Markus Werle wrote:
>>
>>> And this here fails:
>>>
>>> #include <boost/assign/list_of.hpp>
>>> #include <boost/assign/list_inserter.hpp>
>>> #include <boost/tr1/tuple.hpp>
>>>
>>> #include <list>
>>>
>>> int main(int argc, char* argv[])
>>> {
>>> 	typedef std::list<std::tr1::tuple<int, std::string> > mod_list_t;
>>>
>>> 	static mod_list_t const l = 
>>> 		boost::assign::tuple_list_of(1, "A")(2, "B"); 
>>>
>>> 	return 0;
>>> }
>>>
>>>
>>> Any hint?
>> I'm not familiar with boost assign. Could you please provide a test
>> case that does not use boost.assign?
> 
> Actually I played around with boost::assign and tried to fix this myself.
> The problem is that boost::assign::tuple_list_of(...) returns something
(Continue reading)

Markus Werle | 20 Aug 15:37

Re: [tr1][fusion] tuple / autoconversion problem

Joel de Guzman <joel <at> boost-consulting.com> writes:

> I'm not familiar with boost assign. Could you please provide a test
> case that does not use boost.assign?

I made a fix proposal in http://svn.boost.org/trac/boost/ticket/2235

Markus

Gmane