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 » Error when I trying to Add in VectorMap container a "C" struct
Error when I trying to Add in VectorMap container a "C" struct [message #23031] Wed, 09 September 2009 15:54 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Hello all,

Help me please how can I add in VectorMap or in other container a C type struct.

I have the following situation:
extern "C" {
typedef struct C_CLASS {
	...
} C_CLASS;
}
....
typedef VectorMap<String, C_CLASS > RegistrationMap;
....
RegistrationMap     tempExactMatchMap_;


I have an error becouse the C_CLASS is not moveable.

I read that the C_Class must be moveable. How can I make this moveable?

With respect,
Ion Lupascu (tojocky)

[Updated on: Wed, 09 September 2009 15:56]

Report message to a moderator

Re: Error when I trying to Add in VectorMap container a "C" struct [message #23034 is a reply to message #23031] Wed, 09 September 2009 17:27 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Ion, first of all, you should check if Vector as the right type of flavor for you. May be ArrayMap fits well into your program - it has no Moveable requirement and less side effects than VectorMap.

If VectorMap is required, consider using Moveable:
struct MyType: Moveable<MyType>
{
...
};


Remember that Moveable type shouldn`t contain any pointers.
Additional requirements are listed in the VectorMap help topic.
Re: Error when I trying to Add in VectorMap container a "C" struct [message #23036 is a reply to message #23034] Wed, 09 September 2009 18:41 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I read it every night, until I realized the essence of the case.
http://www.ultimatepp.org/srcdoc$Core$Tutorial$en-us.html

I recommend reading it slowly, several times. This is the foundation.

Please do not take offense at the didactic tone. These recommendations from the heart.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Error when I trying to Add in VectorMap container a "C" struct [message #23039 is a reply to message #23036] Thu, 10 September 2009 08:06 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

sergeynikitin wrote on Wed, 09 September 2009 19:41

I read it every night, until I realized the essence of the case.
http://www.ultimatepp.org/srcdoc$Core$Tutorial$en-us.html

I recommend reading it slowly, several times. This is the foundation.

Please do not take offense at the didactic tone. These recommendations from the heart.


Thank you to all!
I found in the help topic:

Alternatively the NTL_MOVEABLE macro can be used to mark types as moveable if the class interface can not be changed, such as in:

NTL_MOVEABLE(std::string);


Thanks to guys who create this macro and write this help!

Now, I working on the cross-os plugin framework. If My tests will be favorable I will share!
Re: Error when I trying to Add in VectorMap container a "C" struct [message #23040 is a reply to message #23039] Thu, 10 September 2009 09:16 Go to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

The solution is really beautiful.

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Previous Topic: compressed serialization
Next Topic: How to re-initialize random generator?
Goto Forum:
  


Current Time: Thu Apr 25 05:54:55 CEST 2024

Total time taken to generate the page: 0.04075 seconds