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 » U++ Library support » U++ Core » String isn't pickable?
String isn't pickable? [message #36471] Wed, 30 May 2012 18:41 Go to next message
piotr5 is currently offline  piotr5
Messages: 107
Registered: November 2005
Experienced Member
while compiling
Vector<String> v;
String a=s.Mid(from,to-from);
v.InsertPick(FindLowerBound(v,a),a);

I get the errors
In file included from C:\comp\upp\uppsrc/Core/Core.h:239:0,
                 from C:\comp\upp\uppsrc/Draw/Draw.h:6,
                 from C:\comp\upp\uppsrc/RichText/RichText.h:4,
                 from C:\comp\upp\uppsrc/CtrlCore/CtrlCore.h:4,
                 from C:\comp\upp\uppsrc/CtrlLib/CtrlLib.h:4,
                 from C:\Users\p\MyApps\bookcat\/bookcat.h:4,
                 from C:\Users\p\MyApps\bookcat\main.cpp:1:
C:\comp\upp\uppsrc/Core/Vcont.hpp: In member function 'T& Upp::Vector<T>::InsertPick(int, const T&) [with T = Upp::String]':
C:\Users\p\MyApps\bookcat\main.cpp:129:38:   instantiated from here
C:\comp\upp\uppsrc/Core/Vcont.hpp:280:2: error: conversion from 'Upp::String' to 'void*' is ambiguous
C:\comp\upp\uppsrc/Core/Vcont.hpp:280:2: note: candidates are:
C:\comp\upp\uppsrc/Core/String.h:54:2: note: Upp::AString<B>::operator const void*() const [with B = Upp::String0] <near match>
C:\comp\upp\uppsrc/Core/String.h:54:2: note:   no known conversion for implicit 'this' parameter from 'const void*' to 'void*'
C:\comp\upp\uppsrc/Core/String.h:53:2: note: Upp::AString<B>::operator const bchar*() const [with B = Upp::String0, Upp::AString<B>::bchar = unsigne
	d char] <near match>
C:\comp\upp\uppsrc/Core/String.h:53:2: note:   no known conversion for implicit 'this' parameter from 'const bchar* {aka const unsigned char*}' to '
	void*'
C:\comp\upp\uppsrc/Core/String.h:51:2: note: Upp::AString<B>::operator const tchar*() const [with B = Upp::String0, Upp::AString<B>::tchar = char] <
	near match>
C:\comp\upp\uppsrc/Core/String.h:51:2: note:   no known conversion for implicit 'this' parameter from 'const tchar* {aka const char*}' to 'void*'
c:\code\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/new:103:14: error:   initializing argument 2 of 'void* operator new(std::size_t, void*)'

without the Pick it compiles normally. is that a new behaviour of gcc 4.6.2?
Re: String isn't pickable? [message #36477 is a reply to message #36471] Thu, 31 May 2012 07:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Yes, String is not pickable. It is "full copy semantics" type with 'fast' deep copy.

In practice, only containers are pickable.
Re: String isn't pickable? [message #36532 is a reply to message #36477] Tue, 05 June 2012 13:53 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
what about copy on write, shared ptr otherwise?
or is the benefit neglectable?
Re: String isn't pickable? [message #36550 is a reply to message #36532] Fri, 08 June 2012 15:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Tue, 05 June 2012 07:53

what about copy on write, shared ptr otherwise?
or is the benefit neglectable?


Well, but now you are speaking about implementations, not interface semantics...

(In fact, String is using a lot of tricks to make copies fast, it has 3 storage levels, last one is using shared reference counted pointer, copy on write implementation).
Re: String isn't pickable? [message #36579 is a reply to message #36550] Mon, 11 June 2012 09:00 Go to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i didn't expect less from Upp Very Happy
was just wondering..
Previous Topic: Problem with Droplists and new Value
Next Topic: How to mark a class of function is deprecated
Goto Forum:
  


Current Time: Thu Mar 28 13:27:11 CET 2024

Total time taken to generate the page: 0.01795 seconds