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 » Improved std::[w]string support
Improved std::[w]string support [message #56175] Wed, 03 February 2021 18:02 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This is now possible

	{
		String h = "Hello world";
		std::string sh = h;
		DDUMP(sh);
		h = sh;
		DDUMP(h);
		Value v = sh;
		DDUMP(v);
		sh = v;
		DDUMP(sh);
	}

	{
		WString h = "Hello world";
		std::wstring sh = h;
		DDUMP(sh);
		h = sh;
		DDUMP(h);
		Value v = sh;
		DDUMP(v);
		sh = v;
		DDUMP(sh);
	}


...because why not... Smile
Re: Improved std::[w]string support [message #56176 is a reply to message #56175] Wed, 03 February 2021 18:58 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Fantastic Surprised Surprised

std::string support in U++ has always been source of problems
This WILL help Smile
Re: Improved std::[w]string support [message #56177 is a reply to message #56176] Wed, 03 February 2021 19:15 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Didier wrote on Wed, 03 February 2021 18:58
Fantastic Surprised Surprised

std::string support in U++ has always been source of problems
This WILL help Smile


Actually, it was always there... Just needed explicit casts here and there. Now it does not.
Re: Improved std::[w]string support [message #56178 is a reply to message #56177] Wed, 03 February 2021 20:07 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mirek,

It seems that this change cause compilation problem on Linux with GCC (a lot of warnings):
/home/klugier/upp/uppsrc/Core/Value.h: In function 'bool Upp::operator!=(Upp::String, const Upp::Value&)':
/home/klugier/upp/uppsrc/Core/Value.h:341:73: error: call of overloaded 'String(const Upp::Value&)' is ambiguous
  341 | inline bool operator!=(T x, const Value& v)   { return v.Is<VT>() ? (VT)v != x : v != Value(x); } \
      |                                                                         ^
/home/klugier/upp/uppsrc/Core/Value.h:343:26: note: in expansion of macro 'VALUE_COMPARE_V'
  343 | #define VALUE_COMPARE(T) VALUE_COMPARE_V(T, T)
      |                          ^~~~~~~~~~~~~~~
/home/klugier/upp/uppsrc/Core/Value.h:351:1: note: in expansion of macro 'VALUE_COMPARE'
  351 | VALUE_COMPARE(String)
      | ^~~~~~~~~~~~~
In file included from /home/klugier/upp/uppsrc/Core/Core.h:302,
                 from /home/klugier/upp/uppsrc/ide/Builders/BuilderUtils.h:4,
                 from /home/klugier/upp/uppsrc/ide/Builders/BuilderUtils.cpp:1:
/home/klugier/upp/uppsrc/Core/String.h:403:2: note: candidate: 'Upp::String::String(const string&)'
  403 |  String(const std::string& s)                           { String0::Set0(s.c_str(), (int)s.length()); }
      |  ^~~~~~
/home/klugier/upp/uppsrc/Core/String.h:386:2: note: candidate: 'Upp::String::String(Upp::String&&)'
  386 |  String(String&& s)                                     { String0::Pick0(pick(s)); }
      |  ^~~~~~
/home/klugier/upp/uppsrc/Core/String.h:385:2: note: candidate: 'Upp::String::String(const Upp::String&)'
  385 |  String(const String& s)                                { String0::Set0(s); }
      |  ^~~~~~


Klugier


U++ - one framework to rule them all.
Re: Improved std::[w]string support [message #56179 is a reply to message #56178] Wed, 03 February 2021 23:56 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Klugier wrote on Wed, 03 February 2021 20:07
Hello Mirek,

It seems that this change cause compilation problem on Linux with GCC (a lot of warnings):
/home/klugier/upp/uppsrc/Core/Value.h: In function 'bool Upp::operator!=(Upp::String, const Upp::Value&)':
/home/klugier/upp/uppsrc/Core/Value.h:341:73: error: call of overloaded 'String(const Upp::Value&)' is ambiguous
  341 | inline bool operator!=(T x, const Value& v)   { return v.Is<VT>() ? (VT)v != x : v != Value(x); } \
      |                                                                         ^
/home/klugier/upp/uppsrc/Core/Value.h:343:26: note: in expansion of macro 'VALUE_COMPARE_V'
  343 | #define VALUE_COMPARE(T) VALUE_COMPARE_V(T, T)
      |                          ^~~~~~~~~~~~~~~
/home/klugier/upp/uppsrc/Core/Value.h:351:1: note: in expansion of macro 'VALUE_COMPARE'
  351 | VALUE_COMPARE(String)
      | ^~~~~~~~~~~~~
In file included from /home/klugier/upp/uppsrc/Core/Core.h:302,
                 from /home/klugier/upp/uppsrc/ide/Builders/BuilderUtils.h:4,
                 from /home/klugier/upp/uppsrc/ide/Builders/BuilderUtils.cpp:1:
/home/klugier/upp/uppsrc/Core/String.h:403:2: note: candidate: 'Upp::String::String(const string&)'
  403 |  String(const std::string& s)                           { String0::Set0(s.c_str(), (int)s.length()); }
      |  ^~~~~~
/home/klugier/upp/uppsrc/Core/String.h:386:2: note: candidate: 'Upp::String::String(Upp::String&&)'
  386 |  String(String&& s)                                     { String0::Pick0(pick(s)); }
      |  ^~~~~~
/home/klugier/upp/uppsrc/Core/String.h:385:2: note: candidate: 'Upp::String::String(const Upp::String&)'
  385 |  String(const String& s)                                { String0::Set0(s); }
      |  ^~~~~~


Klugier


I believe it is a compiler bug and I was not able to navigate around it. Thus above demo had to be changed to

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	StdLogSetup(LOG_COUT|LOG_FILE);
	{
		String h = "Hello world";
		std::string sh = h.ToStd();
		DDUMP(sh);
		h = sh;
		DDUMP(h);
		Value v = sh;
		DDUMP(v);
		sh = v.ToStd();
		DDUMP(sh);
	}

	{
		WString h = "Hello world";
		std::wstring sh = h.ToStd();
		DDUMP(sh);
		h = sh;
		DDUMP(h);
		Value v = sh;
		DDUMP(v);
		sh = v.ToWStd();
		DDUMP(sh);
	}
	CheckLogEtalon();
}
Previous Topic: ide: ContextGoto now works with AK_ KEY definitions (jumps into .key file)
Next Topic: ide diff dialogs improved
Goto Forum:
  


Current Time: Thu Apr 25 23:00:48 CEST 2024

Total time taken to generate the page: 0.05555 seconds