473,466 Members | 1,301 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

map vs. set (stl)

Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.

std::map< name, value >

But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose, I
make it look like this...

class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};

This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the whole
value is not.

Should I really be using a set like this?

May 23 '07 #1
13 10264
Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.

std::map< name, value >

But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose, I
make it look like this...

class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};

This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the whole
value is not.

Should I really be using a set like this?
Sounds like you just need a vector...

F
May 23 '07 #2
Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.

std::map< name, value >

But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose, I
make it look like this...

class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};

This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the whole
value is not.

Should I really be using a set like this?
I think it's always worth refining your design so that it's natural, so
it feels right. You seem to be thinking about the value class solely in
terms of it's role within the set. Try thinking about the value class
independently instead of how you might be using it in a map or set.

You might find that a custom comparator for a set is the way to go.

john
May 23 '07 #3
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.

std::map< name, value >

But then I realize that 'name' should actually be one of the members of
'value' class, so I have a redundancy. I then switch and start using
std::set< value >. To make 'value' suitable for this purpose, I make it
look like this...

class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};

This now satisfies the requirements of a set, and it works. Great. But
I feel as though I have really strayed far from the idea of a set. For
example, the key part of my value is constant, but the whole value is
not.

Should I really be using a set like this?
The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering of the
set.

--
Markus Schoder
May 23 '07 #4
On May 23, 3:58 pm, Fei Liu <fei...@aepnetworks.comwrote:
Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose, I
make it look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the whole
value is not.
Should I really be using a set like this?

Sounds like you just need a vector...

F
But the set will be sorted so it (like the map) has faster random
lookup then the vector.
OP.

May 23 '07 #5
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members of
'value' class, so I have a redundancy. I then switch and start using
std::set< value >. To make 'value' suitable for this purpose, I make it
look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great. But
I feel as though I have really strayed far from the idea of a set. For
example, the key part of my value is constant, but the whole value is
not.
Should I really be using a set like this?

The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering of the
set.

--
Markus Schoder
Yes, that is what you would expect.

However, in my STL, the set::find function returns a non-const
iterator, so I can modify the elements of the set. Of course, I must
be careful not to change the key value.

I'm using the STL that comes with MS VC8. I don't know if this
behavior conforms to the standard or not.

May 23 '07 #6
On Wed, 23 May 2007 15:29:54 -0700, Qwavel wrote:
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
>On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose,
I make it look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the
whole value is not.
Should I really be using a set like this?

The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering of
the set.

Yes, that is what you would expect.

However, in my STL, the set::find function returns a non-const iterator,
so I can modify the elements of the set. Of course, I must be careful
not to change the key value.

I'm using the STL that comes with MS VC8. I don't know if this behavior
conforms to the standard or not.
The current wording of the standard surprisingly _requires_ this behavior
but there is a defect report pending (103) that proposes to change this
and make keys in associative containers immutable.

--
Markus Schoder
May 23 '07 #7
On May 23, 7:39 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 15:29:54 -0700, Qwavel wrote:
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose,
I make it look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the
whole value is not.
Should I really be using a set like this?
The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering of
the set.
Yes, that is what you would expect.
However, in my STL, the set::find function returns a non-const iterator,
so I can modify the elements of the set. Of course, I must be careful
not to change the key value.
I'm using the STL that comes with MS VC8. I don't know if this behavior
conforms to the standard or not.

The current wording of the standard surprisingly _requires_ this behavior
but there is a defect report pending (103) that proposes to change this
and make keys in associative containers immutable.

--
Markus Schoder
Yikes! That change would break some of my code.

Does that mean that the best solution for me is to use
std::map<key,value>, in spite of the fact that I would then have two
copies of the key (since 'value' contains the key)?

It would not be efficient for me to erase and re-add the value just to
modify it.

Qwavel (OP)

May 24 '07 #8
On May 24, 12:29 am, Qwavel <qwa...@gmail.comwrote:
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members of
'value' class, so I have a redundancy. I then switch and start using
std::set< value >. To make 'value' suitable for this purpose, I makeit
look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great. But
I feel as though I have really strayed far from the idea of a set. For
example, the key part of my value is constant, but the whole value is
not.
Should I really be using a set like this?
The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering of the
set.
Yes, that is what you would expect.
It depends on where you are coming from. There was extensive
discussion (and disagreement) about this in the committee;
people with a data base background tend to think of set and
multiset as a keyed table, in which case, one field is the key
(and cannot be modified), and the others are not (and can be
modified). Others see it more as an ordered set, in which any
modifications might perturbe the ordering criteria.

The final decision went with the second interpretation, probably
mainly because there was no way to specify what the fields are,
which one is the key, and to make it unmodifiable. The current
interface basically provides no way of only being able to modify
part of an element. The "official" solution for this is to
extract the element from the set (removing it), modify it, and
then reinsert it.

If I were modeling a data base, I'd probably do something along
the lines of what you propose, with an element type in which the
key fields are declared const. Of course (at least according to
the original standard), you cannot instantiate a container over
a class type with constant members (and recent versions of g++
complain if you try to do so), you have to resort to a set of
pointers---which also solves the problem of const-ness:-) (but
introduces one of lifetime management).

Most of the time, however, I'll just use map, and live with the
duplication. Especially since set or multiset require a
complete element type for find, where as map just requires the
key type. I'm not adverse to using a set of pointers for
secondary keys, however. (In such a case, you might arrange
for the primary key to be something cheap to duplicate, like an
int, and use more expensive types, like string, for the
secondary keys.)
However, in my STL, the set::find function returns a non-const
iterator, so I can modify the elements of the set.
The fact that the iterator is non-const doesn't necessarily mean
that you can modify values through it. The only versions of the
standard I have handy are the original (1998) and the latest
draft. In the latest draft, it explicitly says that "For
associative containers where the value type is the same as the
key type, both iterator and const_iterator are constant
iterators. It is unspecified whether or not iterator and
const_iterator are the same type." I believe that this text was
already present in the 2003 revised version of the standard, but
I don't have that here to verify.

I mentionned before that this issue has been the subject of much
discussion in the committee. Regretfully, most of that
discussion was after the publication of the original standard,
in response to defect reports. The original standard says
almost nothing about this, and early implementations varied.

Today, of course, the standard says what it says, but for
implementations which originally allowed modification, given the
choice between breaking existing user code or strictly adhering
to the (from their point of view modified) standard, it's
understandable that they are not rushing to change.
Of course, I must
be careful not to change the key value.
I'm using the STL that comes with MS VC8. I don't know if this
behavior conforms to the standard or not.
If you can modify the element through an iterator returned by
find, the implementation does not conform with the proposed
draft, and I don't think it conforms with the 2003 version of
the standard. The original standard was vague enough that just
about anything conformed, however, and even the intent was not
very clear. In this case, MS implemented a very reasonable
(perhaps the most reasonable) interpretation of the original
standard, and is now hesitant about updating to the current
standard, for fear of breaking existing user code. (Or maybe
for other, less laudable reasons, but I prefer always to give
the benefit of the doubt.)

Note too that if the instantiation type has const members, the
code has always had undefined behavior, and has never been
officially supported, by MS or by anyone else, even though it
probably worked just about everywhere. This requirement has
been lifted in the latest draft, however. (The requirement
stems from the requirement in the original standard that the
instantiation type of all containers be assignable; a class with
const elements isn't assignable. In practice, assignment isn't
necessary for node based containers like set or list, however,
and the current draft removes that requirement from them.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

May 24 '07 #9
On May 24, 1:39 am, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 15:29:54 -0700, Qwavel wrote:
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members
of 'value' class, so I have a redundancy. I then switch and start
using std::set< value >. To make 'value' suitable for this purpose,
I make it look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great.
But I feel as though I have really strayed far from the idea of a
set. For example, the key part of my value is constant, but the
whole value is not.
Should I really be using a set like this?
The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering of
the set.
Yes, that is what you would expect.
However, in my STL, the set::find function returns a non-const iterator,
so I can modify the elements of the set. Of course, I must be careful
not to change the key value.
I'm using the STL that comes with MS VC8. I don't know if this behavior
conforms to the standard or not.
The current wording of the standard surprisingly _requires_ this behavior
but there is a defect report pending (103) that proposes to change this
and make keys in associative containers immutable.
The wording in the original standard required [multi]set::find()
on a non-const object to return a type [multi]set::iterator. It
did NOT require that you be able to modify the object through
the (non-const) iterator, and early implementations varied, some
using exactly the same type for iterator and const_iterator.

The discussions on this subjet were quite long, but the final
decision is that trying to modify the element through the
iterator, even if it was non-const, is undefined behavior. The
current draft has been modified to reflect this---I think it is
also in TC1 (and thuse the 2003 version of the standard).

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

May 24 '07 #10
On May 24, 1:57 am, Qwavel <qwa...@gmail.comwrote:
On May 23, 7:39 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
[...]
I'm using the STL that comes with MS VC8. I don't know if
this behavior conforms to the standard or not.
The current wording of the standard surprisingly _requires_
this behavior but there is a defect report pending (103)
that proposes to change this and make keys in associative
containers immutable.
Yikes! That change would break some of my code.
It's not so much a change as a clarification.
Does that mean that the best solution for me is to use
std::map<key,value>, in spite of the fact that I would then have two
copies of the key (since 'value' contains the key)?
It depends. If key isn't expensive to duplicate, why not? It
has the advantage that you can look up with just a key; you
don't have to construct a complete value.

The alterative would be a set of pointers:
std::set< value*, ValueKeyCmp >
where ValueKeyCmp is something like:

struct ValueKeyCmp
{
bool operator()( value const* a, value const* b ) const
{
return a->name() < b->name() ;
}
} ;

This would also allow using const members for the elements in
the key.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

May 24 '07 #11
On May 24, 8:22 am, James Kanze <james.ka...@gmail.comwrote:
On May 24, 12:29 am, Qwavel <qwa...@gmail.comwrote:
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type, and
'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the members of
'value' class, so I have a redundancy. I then switch and start using
std::set< value >. To make 'value' suitable for this purpose, I make it
look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works. Great.But
I feel as though I have really strayed far from the idea of a set. For
example, the key part of my value is constant, but the whole value is
not.
Should I really be using a set like this?
The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator is
basically always a const iterator to prevent breaking the ordering ofthe
set.
Yes, that is what you would expect.

It depends on where you are coming from. There was extensive
discussion (and disagreement) about this in the committee;
people with a data base background tend to think of set and
multiset as a keyed table, in which case, one field is the key
(and cannot be modified), and the others are not (and can be
modified). Others see it more as an ordered set, in which any
modifications might perturbe the ordering criteria.

The final decision went with the second interpretation, probably
mainly because there was no way to specify what the fields are,
which one is the key, and to make it unmodifiable. The current
interface basically provides no way of only being able to modify
part of an element. The "official" solution for this is to
extract the element from the set (removing it), modify it, and
then reinsert it.

If I were modeling a data base, I'd probably do something along
the lines of what you propose, with an element type in which the
key fields are declared const. Of course (at least according to
the original standard), you cannot instantiate a container over
a class type with constant members (and recent versions of g++
complain if you try to do so), you have to resort to a set of
pointers---which also solves the problem of const-ness:-) (but
introduces one of lifetime management).

Most of the time, however, I'll just use map, and live with the
duplication. Especially since set or multiset require a
complete element type for find, where as map just requires the
key type. I'm not adverse to using a set of pointers for
secondary keys, however. (In such a case, you might arrange
for the primary key to be something cheap to duplicate, like an
int, and use more expensive types, like string, for the
secondary keys.)
However, in my STL, the set::find function returns a non-const
iterator, so I can modify the elements of the set.

The fact that the iterator is non-const doesn't necessarily mean
that you can modify values through it. The only versions of the
standard I have handy are the original (1998) and the latest
draft. In the latest draft, it explicitly says that "For
associative containers where the value type is the same as the
key type, both iterator and const_iterator are constant
iterators. It is unspecified whether or not iterator and
const_iterator are the same type." I believe that this text was
already present in the 2003 revised version of the standard, but
I don't have that here to verify.

I mentionned before that this issue has been the subject of much
discussion in the committee. Regretfully, most of that
discussion was after the publication of the original standard,
in response to defect reports. The original standard says
almost nothing about this, and early implementations varied.

Today, of course, the standard says what it says, but for
implementations which originally allowed modification, given the
choice between breaking existing user code or strictly adhering
to the (from their point of view modified) standard, it's
understandable that they are not rushing to change.
Of course, I must
be careful not to change the key value.
I'm using the STL that comes with MS VC8. I don't know if this
behavior conforms to the standard or not.

If you can modify the element through an iterator returned by
find, the implementation does not conform with the proposed
draft, and I don't think it conforms with the 2003 version of
the standard. The original standard was vague enough that just
about anything conformed, however, and even the intent was not
very clear. In this case, MS implemented a very reasonable
(perhaps the most reasonable) interpretation of the original
standard, and is now hesitant about updating to the current
standard, for fear of breaking existing user code. (Or maybe
for other, less laudable reasons, but I prefer always to give
the benefit of the doubt.)

Note too that if the instantiation type has const members, the
code has always had undefined behavior, and has never been
officially supported, by MS or by anyone else, even though it
probably worked just about everywhere. This requirement has
been lifted in the latest draft, however. (The requirement
stems from the requirement in the original standard that the
instantiation type of all containers be assignable; a class with
const elements isn't assignable. In practice, assignment isn't
necessary for node based containers like set or list, however,
and the current draft removes that requirement from them.)

--
James Kanze (GABI Software) email:james.ka...@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Thanks for the detailed reponse. Very helpful and interesting.

May 24 '07 #12
On Thu, 24 May 2007 05:26:41 -0700, James Kanze wrote:
On May 24, 1:39 am, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
>On Wed, 23 May 2007 15:29:54 -0700, Qwavel wrote:
On May 23, 4:59 pm, Markus Schoder <a3vr6dsg-use...@yahoo.dewrote:
On Wed, 23 May 2007 12:41:18 -0700, Qwavel wrote:
Let's say I have something like this, where 'name' is a POD type,
and 'value' is a class.
std::map< name, value >
But then I realize that 'name' should actually be one of the
members of 'value' class, so I have a redundancy. I then switch
and start using std::set< value >. To make 'value' suitable for
this purpose, I make it look like this...
class value {
const int name;
bool operator<( const value& rhs ) const
{ return name < rhs.name; }
void operator=( const value& rhs );
...
};
This now satisfies the requirements of a set, and it works.
Great. But I feel as though I have really strayed far from the
idea of a set. For example, the key part of my value is constant,
but the whole value is not.
Should I really be using a set like this?
>The problem you might be facing is that you cannot (without casting)
modify the objects in the set through a set iterator. A set iterator
is basically always a const iterator to prevent breaking the
ordering of the set.
Yes, that is what you would expect.
However, in my STL, the set::find function returns a non-const
iterator, so I can modify the elements of the set. Of course, I must
be careful not to change the key value.
I'm using the STL that comes with MS VC8. I don't know if this
behavior conforms to the standard or not.
>The current wording of the standard surprisingly _requires_ this
behavior but there is a defect report pending (103) that proposes to
change this and make keys in associative containers immutable.

The wording in the original standard required [multi]set::find() on a
non-const object to return a type [multi]set::iterator. It did NOT
require that you be able to modify the object through the (non-const)
iterator, and early implementations varied, some using exactly the same
type for iterator and const_iterator.
The current wording in the standard says that X::iterator is an iterator
pointing to T and X::const_iterator is an iterator pointing to const T
where X is the container and T its value_type. This implies that
implementations where X::const_iterator and X::iterator are the same type
are non-conforming. Also modifications through X::iterator are possible
since the value_type T must also be assignable.
The discussions on this subjet were quite long, but the final decision
is that trying to modify the element through the iterator, even if it
was non-const, is undefined behavior. The current draft has been
modified to reflect this---I think it is also in TC1 (and thuse the 2003
version of the standard).
It is not in the 2003 version.

--
Markus Schoder
May 24 '07 #13
On May 23, 11:14 pm, Qwavel <qwa...@gmail.comwrote:
On May 23, 3:58 pm, Fei Liu <fei...@aepnetworks.comwrote:

Should I really be using a set like this?
Sounds like you just need a vector...
F

But the set will be sorted so it (like the map) has faster random
lookup then the vector.
OP.
You will be surprised that sorted vector and lower_bound
are almost always better choice. Lower memory footprint
and faster lookup.
Only if there are many inserts/updates/removes on big vector
set/map is better choice.

Greetings, Branimir.

May 24 '07 #14

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

Similar topics

41
by: Allan Bruce | last post by:
Hi there, I am interested to know if there are any C++ programmers who do not use STL. I have been coding in C++ for a year or so now, although only recently have I started a large(ish)-scale...
2
by: Steve | last post by:
Just wondering if someone can point me to a good, easy to understand online tutorial on STL functions. All the programming manuals I have predate STL, and I would like to learn more about modern...
25
by: Norm Matloff | last post by:
Anyone have an answer--just a guess would do--as to what percentage of programmers who do their primary work in C++ make use of the STL? Norm Matloff
13
by: Alvin | last post by:
Correct me if I am wrong, but the STL standard only defines the interface only and not the implementation, right? For example, say I use a std::map. The speed and efficiency of the operator(key)...
11
by: RR | last post by:
I have Plauger's book on STL and I've found that it's different from the STL I have on a Linux box (libstdc++-2.96-112). In particular, the map::erase(iterator) method I have returns nothing...
0
by: Tony Johansson | last post by:
Hello! I have two classes called Handle which is a template class and a class Integer which is not a template class. The Integer class is just a wrapper class for a primitive int with some...
0
by: rajd99 | last post by:
Hi, I am getting the following error while compiling with sun C++ 5.5 and using SGI STL. Has anyone run into this. The SGI headers are one at http://www.sgi.com/tech/stl/download.html Thanks, ...
20
by: Andrew Roberts | last post by:
Any more info on this? Anyone know when it will be released?
6
by: Bart Simpson | last post by:
I am writing a shared object (Dll in Windows) and I am making extensive use of the STL. I am getting lots of warnings like this: ClassA.h(139): warning C4251: 'ClassA::indexarray' : class...
9
by: OuaisBla | last post by:
Although STL container can't support object by reference as a template argument. To make thing worse, allocator can't support stack based allocation. So: std::deque<std::string const &> is...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
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 ...

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.