473,651 Members | 3,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with inserting custom types into STL map

Hello, this is my problem:

I have a map:

typedef map<string, bfdb_recordBFDB ;

where:

typedef struct
{
size_t seq_no;
StdBloomFilter bf;
} bfdb_record;

where:

class StdBloomFilter : public BloomFilter
{
private:
vector<bool__fi lter;
size_t __size;
public:
StdBloomFilter( ):__filter(0),_ _size(0){};
StdBloomFilter( size_t _size): __filter(_size) , __size(_size) {};
StdBloomFilter( const StdBloomFilter& _source);

virtual ~StdBloomFilter (){};

operator CountingBloomFi lter();
StdBloomFilter& operator=(const StdBloomFilter& );

void set(size_t _pos);
bool test(size_t _pos) const;

void clear();
size_t size() const;
void merge(const StdBloomFilter& _source);

string to_string();
};

now I want to insert structure into my map:

__db.insert(mak e_pair(_id,_inf o));
or
__db[_id] = _info;
or
__db.insert(BFD B::value_type(_ id, _info));

I get a runtime error:

8 [main] LE 2560 _cygtls::handle _exceptions: Exception:
STATUS_ACCESS_V IOLATION
985 [main] LE 2560 open_stackdumpf ile: Dumping stack trace to
LE.exe.stackdum p

Is something in StdBloomFilter missing. If I change bf to int type in
the bfdb_record struct then everything works, but that is not what I
need!!!

Please help

Apr 2 '07 #1
10 2624
ua****@gmail.co m wrote:
Hello, this is my problem:

I have a map:

typedef map<string, bfdb_recordBFDB ;

where:

typedef struct
{
size_t seq_no;
StdBloomFilter bf;
} bfdb_record;
That's C. You want

struct bfdb_record
{
size_t seq_no;
StdBloomFilter bf;
};

Are you sure you want to copy the entire StdBloomFilter object each time
you do an insert?
where:

class StdBloomFilter : public BloomFilter
{
private:
vector<bool__fi lter;
size_t __size;
Those are illegal names, anything starting with double underscore is
reserved.
>
now I want to insert structure into my map:

__db.insert(mak e_pair(_id,_inf o));
or
__db[_id] = _info;
or
__db.insert(BFD B::value_type(_ id, _info));

I get a runtime error:
What does your StdBloomFilter copy constructor do?

--
Ian Collins.
Apr 2 '07 #2
StdBloomFilter& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
{
this->__size=_source .__size;
this->__filter =_source.__filt er;
}

And what should it do? These are no pointers. These should be copies
by value, right? It was not working, so I added this dummy copy
constructor, but it still does not work.

Apr 2 '07 #3
ua****@gmail.co m wrote:

Please quote the appropriate context, this post makes no sense on its own.
StdBloomFilter& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
{
this->__size=_source .__size;
this->__filter =_source.__filt er;
You realy should get rid of these illegal names.
}

And what should it do? These are no pointers. These should be copies
by value, right? It was not working, so I added this dummy copy
constructor, but it still does not work.
Run you code under a debugger and see what it is doing. You don't show
the base class, so the problem may well be in there.

--
Ian Collins.
Apr 2 '07 #4
On Apr 2, 4:29 pm, Ian Collins <ian-n...@hotmail.co mwrote:
uar...@gmail.co m wrote:

Please quote the appropriate context, this post makes no sense on its own.
StdBloomFilter& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
{
this->__size=_source .__size;
this->__filter =_source.__filt er;

You realy should get rid of these illegal names.
}
And what should it do? These are no pointers. These should be copies
by value, right? It was not working, so I added this dummy copy
constructor, but it still does not work.

Run you code under a debugger and see what it is doing. You don't show
the base class, so the problem may well be in there.

--
Ian Collins.
I can put StdBloomFilter object into a vector<StdBloom Filterand I
tried to get rid of any base class - does not help. Base class is an
abstract interface.

Apr 2 '07 #5
ua****@gmail.co m wrote:
On Apr 2, 4:29 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>>uar...@gmail. com wrote:

Please quote the appropriate context, this post makes no sense on its own.
>>>StdBloomFilt er& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
{
this->__size=_source .__size;
this->__filter =_source.__filt er;

You realy should get rid of these illegal names.
>>>}
>>>And what should it do? These are no pointers. These should be copies
by value, right? It was not working, so I added this dummy copy
constructo r, but it still does not work.

Run you code under a debugger and see what it is doing. You don't show
the base class, so the problem may well be in there.
*Please* don't quote signatures - the bit after the "-- ".
>
I can put StdBloomFilter object into a vector<StdBloom Filterand I
tried to get rid of any base class - does not help. Base class is an
abstract interface.
What did your debugger show?

--
Ian Collins.
Apr 2 '07 #6
On Apr 2, 4:40 pm, Ian Collins <ian-n...@hotmail.co mwrote:
uar...@gmail.co m wrote:
On Apr 2, 4:29 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>uar...@gmail.c om wrote:
>Please quote the appropriate context, this post makes no sense on its own.
>>StdBloomFilte r& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
{
this->__size=_source .__size;
this->__filter =_source.__filt er;
>You realy should get rid of these illegal names.
>>}
>>And what should it do? These are no pointers. These should be copies
by value, right? It was not working, so I added this dummy copy
constructor , but it still does not work.
>Run you code under a debugger and see what it is doing. You don't show
the base class, so the problem may well be in there.

*Please* don't quote signatures - the bit after the "-- ".
I can put StdBloomFilter object into a vector<StdBloom Filterand I
tried to get rid of any base class - does not help. Base class is an
abstract interface.

What did your debugger show?

--
Ian Collins.
This is what I can catch:

mi_cmd_var_crea te: unable to create variable object
Single stepping until exit from function ntdll!
LdrDisableThrea dCalloutsForDll ,
which has no line number information.
Single stepping until exit from function ntdll!
LdrFindCreatePr ocessManifest,
which has no line number information.
Single stepping until exit from function ntdll!RtlCheckR egistryKey,
which has no line number information.

I compile it in gcc. I installed cygwin on a Windows system and I
debug it in Eclipse. So, this is all I managed to get out of it.

Apr 2 '07 #7
ua****@gmail.co m wrote:
On Apr 2, 4:40 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>>uar...@gmail. com wrote:
>>>On Apr 2, 4:29 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>>>>uar...@gmai l.com wrote:
>>>>Please quote the appropriate context, this post makes no sense on its own.
>>>>>StdBloomFi lter& StdBloomFilter: :operator=(cons t StdBloomFilter&
>_source)
>{
this->__size=_source .__size;
this->__filter =_source.__filt er;
>>>>You realy should get rid of these illegal names.
>>>>>}
>>>>>And what should it do? These are no pointers. These should be copies
>by value, right? It was not working, so I added this dummy copy
>constructo r, but it still does not work.
>>>>Run you code under a debugger and see what it is doing. You don't show
the base class, so the problem may well be in there.

*Please* don't quote signatures - the bit after the "-- ".

>>>I can put StdBloomFilter object into a vector<StdBloom Filterand I
tried to get rid of any base class - does not help. Base class is an
abstract interface.

What did your debugger show?
*Please* *Please* don't quote signatures - the bit after the "-- ".
>
This is what I can catch:

I compile it in gcc. I installed cygwin on a Windows system and I
debug it in Eclipse. So, this is all I managed to get out of it.
You should be able to see the last line in your code.

I assume you have implemented the assignment operator as well?

--
Ian Collins.
Apr 2 '07 #8
On Apr 2, 4:52 pm, Ian Collins <ian-n...@hotmail.co mwrote:
uar...@gmail.co m wrote:
On Apr 2, 4:40 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>uar...@gmail.c om wrote:
>>On Apr 2, 4:29 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>>>uar...@gmail .com wrote:
>>>Please quote the appropriate context, this post makes no sense on its own.
>>>>StdBloomFil ter& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
{
this->__size=_source .__size;
this->__filter =_source.__filt er;
>>>You realy should get rid of these illegal names.
>>>>}
>>>>And what should it do? These are no pointers. These should be copies
by value, right? It was not working, so I added this dummy copy
constructor , but it still does not work.
>>>Run you code under a debugger and see what it is doing. You don't show
the base class, so the problem may well be in there.
>*Please* don't quote signatures - the bit after the "-- ".
>>I can put StdBloomFilter object into a vector<StdBloom Filterand I
tried to get rid of any base class - does not help. Base class is an
abstract interface.
>What did your debugger show?

*Please* *Please* don't quote signatures - the bit after the "-- ".
This is what I can catch:
I compile it in gcc. I installed cygwin on a Windows system and I
debug it in Eclipse. So, this is all I managed to get out of it.

You should be able to see the last line in your code.

I assume you have implemented the assignment operator as well?
--
Ian Collins.

Well the assignment is smth like:
bool BFDatabase::upd ate(const string& _id, const bfdb_record& _info)
{
BFDB::iterator iter = __db.find(_id);

if (iter==__db.end ())
{
//__db.insert(mak e_pair(_id,_inf o));
__db[_id] = _info;
//__db.insert(BFD B::value_type(_ id, _info));
return true;
}
return false;
}

But the problem is the following:

This works:
StdBloomFilter bf(100);
vector<StdBloom Filtervec;
vec.push_back(b f);

And this does not:
map<int,StdBloo mFilterm;
m.insert(make_p air(5,bf));
Apr 3 '07 #9
ua****@gmail.co m wrote:
StdBloomFilter& StdBloomFilter: :operator=(cons t StdBloomFilter&
_source)
[...]
It was not working, so I added this dummy copy
constructor,
This is not the copy ctor. Show us your

StdBloomFilter: :StdBloomFilter ( const StdBloomFilter& );
Apr 3 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1849
by: Nick Caldwell | last post by:
Y'all, Problem: Reading complex data types returned from WSDL I'll present this in 3 sections. 1. Output of WSDL parser on Google API 2. Output of WSDL parser on Custom API 3. WSDL parser code
3
3141
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit from it. During run time, using a static method, the class creates an instance of the derived class using the Activator class and returns it. This design pattern is very similar to the design pattern applied by the Assembly class. The twist is...
6
5611
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: " The document was understood, but it could not be processed. - The WSDL document contains links that could not be resolved. - There was an error downloading
3
8111
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to run the class it gives an error that "System.Xml.XmlNode.XmlNode() is inaccessible due to its protection level". This error comes because XmlNode has not any public constructor. I found XmlNode has two constructor but both are private or friend...
2
2510
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a pointer or reference to a derived type of the base class's return type. In .NET the overridden virtual function is similar, but an actual parameter of the function can be a derived reference from the base class's reference also. This dichotomy...
2
1318
by: pmcguire | last post by:
I am reposting in this group after getting no response for a week in the deployment group. I have a setup project that uses custom actions. The project installs and runs fine on machines that have the .NET framework 1.1, but fails on machines that have .NET framework 1.1 SP1. The specific error message is: "Unable to get installer types in the <assembly path> assembly. One or more of the types in the assembly unable to load"
0
2604
by: rokuingh | last post by:
ok, so i've been working on this one for quite a while, and the code is very big so i'm just going to give the relevant parts. this is a program that builds polymers (chemical structures of repeated monomers) which are represented as doubly pointed noncomplete binary trees. There are three different types of monomers (hence the three different constructer calling functions) the first one is the "leaves" of the tree, the second adds length...
12
1708
by: Ron M. Newman | last post by:
Hi, I can load an assembly using the Assembly.Load(....) However, I'd like dynamic loading of assemblies to be identical to putting an assembly reference in your VS2005 project. and yes, I know about the unloading problems. Let's say I don't care for the moment. If I have an assemlbly file at "c:\\assembly.dll" - how do I load it at runtime as if it were references in the project at build time? I know
2
3075
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography section: Discography --------------------- DiscID
0
8361
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8701
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.