Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Problems with AddPick operator| in Vector
Problems with AddPick operator| in Vector [message #46463] Fri, 13 May 2016 03:55 Go to next message
Infausto is currently offline  Infausto
Messages: 28
Registered: June 2008
Promising Member
Hi everyone:

I got the following code:
class Caps : Moveable<Caps>
{
public :
	Caps() = default;
	rval_default(Caps);
};

Caps item1;
Caps item2;

Vector<Caps> list;
list.AddPick(pick(item1)); // works fine
list | pick(item2); // Throws error. 

MSC says: Cannot convert argument 1 from 'Caps' to 'Caps &&'
GCC says: Cannot bind 'Caps' lvalue to 'Caps&&'

The error is thrown when the following code is reached:
Vcont.h
...
95:	Vector&  operator|(T rval_ x)    { AddPick(x); return *this; }
...

AddPick(x) is the offending sentence. Why?

Many thanks in advance.
Re: Problems with AddPick operator| in Vector [message #46471 is a reply to message #46463] Sat, 14 May 2016 05:20 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 526
Registered: March 2007
Contributor
change
95:	Vector&  operator|(T rval_ x)    { AddPick(x); return *this; }


to
95:	Vector&  operator|(T rval_ x)    { AddPick( pick(x) ); return *this; }



should fix the problem.
Re: Problems with AddPick operator| in Vector [message #46480 is a reply to message #46471] Sun, 15 May 2016 08:58 Go to previous messageGo to next message
Infausto is currently offline  Infausto
Messages: 28
Registered: June 2008
Promising Member
Yes, i suppose that, but i don't feel very confortable changing the core library. Well, for the sake of time, ill do that, but i hope that the developers of U++ fix this and improve even more U++.

Many thanks in advance.
Re: Problems with AddPick operator| in Vector [message #46484 is a reply to message #46480] Sun, 15 May 2016 14:12 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 526
Registered: March 2007
Contributor
Yeah, it's kind of a bug in the library. It seemed "Pick" thing will be removed in the new core. I guess that's why those little bugs remains.

You may want to post a bug report so that it gets attended..
Re: Problems with AddPick operator| in Vector [message #46485 is a reply to message #46484] Sun, 15 May 2016 14:15 Go to previous message
Lance is currently offline  Lance
Messages: 526
Registered: March 2007
Contributor
C++11 grammar requires the relayed pick() be present (in more standard c++ usage, it translates to std::move() ). So you can be certain that this is a bug.
Previous Topic: Translations in header file
Next Topic: Map with unique keys and transfer semantics?
Goto Forum:
  


Current Time: Thu Mar 28 20:05:26 CET 2024

Total time taken to generate the page: 0.01499 seconds