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 » U++ community news and announcements » EditField::operator String() removed
EditField::operator String() removed [message #46616] Mon, 13 June 2016 09:11 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This is a very unfortunate change, because it breaks existing code, OTOH is very easy to fix...

The problem is:

EditField f;

f << [&] { ... };


This supposed to assign lambda to EditField. However, with implicit cast to String, an alternative overload is

template <class T>
operator<<(String&&, const T&)


because of EditField::operator String().

Well, direct type assignment and retrieval from/to widgets was deprecated for some time, so in the end I decided that it is more important for us to be able to write e.g.

String() << foo << bar;


and always use operator ~ when retrieving value of widget.

So, if after updating to U++ trunk you see error like this:

c:\u\aws\openwind\OpenWind.h(1722): error C2664: 'Upp::FileSel &Upp::FileSel::ActiveDir(const Upp::String &)': cannot convert argument 1 from 'Upp::EditString' to 'const Upp::String &'
c:\u\aws\openwind\OpenWind.h(1722): note: Reason: cannot convert from 'Upp::EditString' to 'const Upp::String'
c:\u\aws\openwind\OpenWind.h(1722): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called


please just add '~' before the widget....

Mirek

[Updated on: Mon, 13 June 2016 09:19]

Report message to a moderator

Re: EditField::operator String() removed [message #46824 is a reply to message #46616] Mon, 22 August 2016 04:42 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I had a problem that may be related to this:

filename0=(String)OutFile;


error: no matching function for call to 'Upp::String::String(Upp::EditField&)'


http://www.ultimatepp.org/forums/index.php?t=msg&th=9730 &start=0&
Previous Topic: Lambda support in MenuBar
Next Topic: NAMESPACE_UPP/END_UPP_NAMESPACE removed
Goto Forum:
  


Current Time: Fri Mar 29 13:22:10 CET 2024

Total time taken to generate the page: 0.01758 seconds