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++ Library : Other (not classified elsewhere) » vectormap exampe is not working anymore
vectormap exampe is not working anymore [message #58382] Sun, 15 May 2022 13:23 Go to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
Hi,

Something changed. If it is a bug or it is not I do not know.

The following definition does not work any more.


VectorMap<int64_t, Vector<Value> > cache;
I compiled it with msc19 x64.

Error is :
D:\upp16236\uppsrc\Core\Vcont.h(195): error C2280: 'Upp::Vector<Upp::Value>::Vector(const Upp::Vector<Upp::Value> &)': attempting to reference a deleted f
unction
D:\upp16236\uppsrc\Core\Vcont.h(326): note: compiler has generated 'Upp::Vector<Upp::Value>::Vector' here
D:\upp16236\uppsrc\Core\Vcont.h(326): note: 'Upp::Vector<Upp::Value>::Vector(const Upp::Vector<Upp::Value> &)': function was implicitly deleted because 'U
pp::Vector<Upp::Value>' has a user-defined move constructor
D:\upp16236\uppsrc\Core\Vcont.h(195): note: while compiling class template member function 'T &Upp::Vector<T>::Add(const T &)'
with
[
T=Upp::Vector<Upp::Value>
]
D:\upp16236\uppsrc\Core\Map.hpp(12): note: see reference to function template instantiation 'T &Upp::Vector<T>::Add(const T &)' being compiled
with
[
T=Upp::Vector<Upp::Value>
]
D:\upp16236\uppsrc\Core\Map.h(36): note: see reference to class template instantiation 'Upp::Vector<Upp::Vector<Upp::Value>>' being compiled
D:\upp16236\uppsrc\Core\Map.h(227): note: see reference to class template instantiation 'Upp::AMap<K,T,Upp::Vector<T>>' being compiled
with
[
K=int64_t,
T=Upp::Vector<Upp::Value>
]
D:\m\upp\tradetester\idatabase.h(16): note: see reference to class template instantiation 'Upp::VectorMap<int64_t,Upp::Vector<Upp::Value>>' being compiled



Can you fix this or provide a solution?
Tnanks.

A.

Re: vectormap exampe is not working anymore [message #58383 is a reply to message #58382] Mon, 16 May 2022 00:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14162
Registered: November 2005
Ultimate Member
Tested this:

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	VectorMap<int64_t, Vector<Value> > cache;
}


Compiles fine with clang and msc64. I guess I need more detailed description or complete example as package.

Mirek
Re: vectormap exampe is not working anymore [message #58396 is a reply to message #58383] Mon, 16 May 2022 15:19 Go to previous messageGo to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
better example


#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{

VectorMap<int64_t, Vector<Value> > cache;
Vector<Value> v;
int line = 0;
cache.FindAdd(line, v);

}

This really fails.


Re: vectormap exampe is not working anymore [message #58397 is a reply to message #58396] Mon, 16 May 2022 16:28 Go to previous message
mirek is currently offline  mirek
Messages: 14162
Registered: November 2005
Ultimate Member
As it should. Vector does not have copy constructor. It was always this way.

cache.FindAdd(line) would do what you need here.

If you really need non-empty init value, use

cache.FindAdd(line, pick(v))

Also consider using GetAdd, e.g.

Vector<Value>& x = cache.GetAdd(line);

is the variant I use most often.

Mirek
Previous Topic: SSL and USEMALLOC
Next Topic: Windows 11 - Menubar issues
Goto Forum:
  


Current Time: Fri Dec 13 23:21:00 CET 2024

Total time taken to generate the page: 0.03711 seconds