hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store
informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the
client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a
std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector.
The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer)
the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but
rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i
use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed
this problem by using an index instead of iterator, but i'm really curious about this.
thanks in advance
janina 18 2834
On Sun, 11 Apr 2004 16:12:40 +0200, "Janina Kramer"
<j.******@school-sucks.com> wrote: hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
Offhand, what you've described doesn't seem like it should be invalidating
that iterator all by itself. Perhaps the iterator is just getting corrupted
by some bug in your program (e.g., assignment using an out-of-bounds vector
index)?
-leor thanks in advance janina
--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
On Sun, 11 Apr 2004 16:12:40 +0200, "Janina Kramer"
<j.******@school-sucks.com> wrote: hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
Offhand, what you've described doesn't seem like it should be invalidating
that iterator all by itself. Perhaps the iterator is just getting corrupted
by some bug in your program (e.g., assignment using an out-of-bounds vector
index)?
-leor thanks in advance janina
--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
"Janina Kramer" <j.******@school-sucks.com> wrote in message
news:c5*************@news.t-online.com... hi ng,
i'm working on a multiplayer game for a variable number of players and on
the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another
std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a
game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective
element of the vector. The strange thing is that when i add elements to the
std::vector<CPosition> (which is nothing more than a usual member of
CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the
memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change
anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a
reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious
about this. thanks in advance janina
I'm afraid that you must have screwed up somewhere because what you say
sounds OK and
I'm willing to bet a lot of money that there is no bug like that which you
describe in std::vector.
Are you sure that the size of the CPlayer vector doesn't change?
How do you create it and how do you add players?
The only reasonables way to do what you say are:
std::vector<CPlayer> players;
players.reserve(MAX_PLAYERS);
for up to MAX_PLAYERS
players.push_back(player);
or
std::vector<CPlayer> players(MAX_PLAYERS);
for each player
setup(players[i]);
The latter would probably be quite ugly.
"Janina Kramer" <j.******@school-sucks.com> wrote in message
news:c5*************@news.t-online.com... hi ng,
i'm working on a multiplayer game for a variable number of players and on
the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another
std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a
game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective
element of the vector. The strange thing is that when i add elements to the
std::vector<CPosition> (which is nothing more than a usual member of
CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the
memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change
anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a
reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious
about this. thanks in advance janina
I'm afraid that you must have screwed up somewhere because what you say
sounds OK and
I'm willing to bet a lot of money that there is no bug like that which you
describe in std::vector.
Are you sure that the size of the CPlayer vector doesn't change?
How do you create it and how do you add players?
The only reasonables way to do what you say are:
std::vector<CPlayer> players;
players.reserve(MAX_PLAYERS);
for up to MAX_PLAYERS
players.push_back(player);
or
std::vector<CPlayer> players(MAX_PLAYERS);
for each player
setup(players[i]);
The latter would probably be quite ugly.
Janina Kramer wrote: i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
If we're guessing, I'll take a shot:
Have you passed a vector into a function by value?
In C++, function arguments are by default passed 'by value':
the argument is copied into the parameter. If the argument is
a vector, this means its elements are copied one by one.
This is very different from Java, which uses reference semantics.
In C++ if you want reference semantics you have to say so.
Here's an example.
#include <vector>
#ifdef WRONG
// By value: v will be a brand new copy of the argument.
std::vector <int>::const_iterator f (std::vector <int> v)
{
return std::find (v.begin (), v.end (), 7);
// The vector 'v' is destroyed here, so the returned
// iterator is invalid.
}
#else
// By reference: v will be a reference to the argument.
std::vector <int>::const_iterator f (std::vector <int> & v)
{
return std::find (v.begin (), v.end (), 7);
// Only the reference 'v' is destroyed. The
// vector it refers to is not affected, so
// the iterator remains valid.
}
#endif
int main ()
{
std::vector <int> u;
u.push_back (7);
if (f (u) == u.end ()) return 1;
else return 0;
}
--
Regards,
Buster.
Janina Kramer wrote: i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
If we're guessing, I'll take a shot:
Have you passed a vector into a function by value?
In C++, function arguments are by default passed 'by value':
the argument is copied into the parameter. If the argument is
a vector, this means its elements are copied one by one.
This is very different from Java, which uses reference semantics.
In C++ if you want reference semantics you have to say so.
Here's an example.
#include <vector>
#ifdef WRONG
// By value: v will be a brand new copy of the argument.
std::vector <int>::const_iterator f (std::vector <int> v)
{
return std::find (v.begin (), v.end (), 7);
// The vector 'v' is destroyed here, so the returned
// iterator is invalid.
}
#else
// By reference: v will be a reference to the argument.
std::vector <int>::const_iterator f (std::vector <int> & v)
{
return std::find (v.begin (), v.end (), 7);
// Only the reference 'v' is destroyed. The
// vector it refers to is not affected, so
// the iterator remains valid.
}
#endif
int main ()
{
std::vector <int> u;
u.push_back (7);
if (f (u) == u.end ()) return 1;
else return 0;
}
--
Regards,
Buster.
i'm using iterators only. no index-access at all.
"Leor Zolman" <le**@bdsoft.com> schrieb im Newsbeitrag news:mr********************************@4ax.com... On Sun, 11 Apr 2004 16:12:40 +0200, "Janina Kramer" <j.******@school-sucks.com> wrote:
hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to
storeinformatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of
CPlayer)the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer"
butrather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
Offhand, what you've described doesn't seem like it should be invalidating that iterator all by itself. Perhaps the iterator is just getting corrupted by some bug in your program (e.g., assignment using an out-of-bounds vector index)? -leor
thanks in advance janina
-- Leor Zolman --- BD Software --- www.bdsoft.com On-Site Training in C/C++, Java, Perl and Unix C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
the vector<CPlayer> is a member of the CGame class and it is never passed to any function.
"Buster" <no***@nowhere.com> schrieb im Newsbeitrag news:c5**********@news6.svr.pol.co.uk... Janina Kramer wrote:
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to
store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of
CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer"
but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't
i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
If we're guessing, I'll take a shot:
Have you passed a vector into a function by value?
In C++, function arguments are by default passed 'by value': the argument is copied into the parameter. If the argument is a vector, this means its elements are copied one by one. This is very different from Java, which uses reference semantics. In C++ if you want reference semantics you have to say so. Here's an example.
#include <vector>
#ifdef WRONG
// By value: v will be a brand new copy of the argument. std::vector <int>::const_iterator f (std::vector <int> v) { return std::find (v.begin (), v.end (), 7); // The vector 'v' is destroyed here, so the returned // iterator is invalid. }
#else
// By reference: v will be a reference to the argument. std::vector <int>::const_iterator f (std::vector <int> & v) { return std::find (v.begin (), v.end (), 7); // Only the reference 'v' is destroyed. The // vector it refers to is not affected, so // the iterator remains valid. }
#endif
int main () { std::vector <int> u; u.push_back (7);
if (f (u) == u.end ()) return 1; else return 0; }
-- Regards, Buster.
i'm using the players.push_back(player) method (without reserve(..) - does that matter?)
i am very sure that the size of the vector doesn't change after assigning the "localplayer" iterator. the number of players is
constant for each round because the CPlayers have isConnected() and such kind of methods, so no need to change the vector size. and
the "localplayer" iterator is assigned after the init-round stuff.
"Nick Hounsome" <nh***@blueyonder.co.uk> schrieb im Newsbeitrag news:5t******************@news-binary.blueyonder.co.uk... "Janina Kramer" <j.******@school-sucks.com> wrote in message news:c5*************@news.t-online.com... hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this. thanks in advance janina
I'm afraid that you must have screwed up somewhere because what you say sounds OK and I'm willing to bet a lot of money that there is no bug like that which you describe in std::vector.
Are you sure that the size of the CPlayer vector doesn't change? How do you create it and how do you add players? The only reasonables way to do what you say are:
std::vector<CPlayer> players; players.reserve(MAX_PLAYERS); for up to MAX_PLAYERS players.push_back(player);
or
std::vector<CPlayer> players(MAX_PLAYERS); for each player setup(players[i]);
The latter would probably be quite ugly.
sorry, forgot to mention that i'm not a newbie. actually, i don't really think that this problem is a bug in the c++-libs (because
someone would have certainly noticed that before i did), but on the other hand i know for sure that i don't change the
vector<CPlayer> in any way after assigning the "localplayer" iterator. i debugged the project line by line and can say that the
exact place where the localplayer iterator becomes invalid is after a call to position.push_back(..) (where position is the already
mentioned CPlayer member of type vector<CPosition>).
thanks again
janina
"Janina Kramer" <j.******@school-sucks.com> schrieb im Newsbeitrag news:c5*************@news.t-online.com... hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to
store informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer"
but rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
thanks in advance janina
On Mon, 12 Apr 2004 03:02:45 +0200, "Janina Kramer"
<j.******@school-sucks.com> wrote: sorry, forgot to mention that i'm not a newbie. actually, i don't really think that this problem is a bug in the c++-libs (because someone would have certainly noticed that before i did), but on the other hand i know for sure that i don't change the vector<CPlayer> in any way after assigning the "localplayer" iterator. i debugged the project line by line and can say that the exact place where the localplayer iterator becomes invalid is after a call to position.push_back(..) (where position is the already mentioned CPlayer member of type vector<CPosition>).
thanks again janina
Since folks seem stumped, perhaps you can give us more informatik? :-)
For starters, the compiler, version and lib you're using, the declarations
of all the data types involved, and the code where you've seen things go
haywire. No promises, but the guesswork around here tends to get much more
accurate once folks see more of those kinds of little details.
-leor
--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
Janina Kramer wrote: sorry, forgot to mention that i'm not a newbie. actually, i don't really think that this problem is a bug in the c++-libs (because someone would have certainly noticed that before i did), but on the other hand i know for sure that i don't change the vector<CPlayer> in any way after assigning the "localplayer" iterator. i debugged the project line by line and can say that the exact place where the localplayer iterator becomes invalid is after a call to position.push_back(..) (where position is the already mentioned CPlayer member of type vector<CPosition>).
Please don't top post!
Do you have access to an access checking tool or debugger? If so, try
it and see what happens.
If not, post some code!
Ian "Janina Kramer" <j.******@school-sucks.com> schrieb im Newsbeitrag news:c5*************@news.t-online.com...
hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to
store
informatik about the players. CPlayer is a class that contains another std::vector<CPosition>. Because one of the players is the client itself (and the size of the vector<CPlayer> doesn't change during a game), i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> (which is nothing more than a usual member of CPlayer) the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer"
but
rather some random position in memory). what's wrong here? i didn't change anything about the std::vector<CPlayer> so why can't i use the "localplayer" iterator any more? and: would it help to store a reference to the element rather than an iterator? i fixed this problem by using an index instead of iterator, but i'm really curious about this.
thanks in advance janina
"Ian" <no***@nowhere.com> schrieb im Newsbeitrag news:10***************@drone5.qsi.net.nz... Janina Kramer wrote: sorry, forgot to mention that i'm not a newbie. actually, i don't really think that this problem is a bug in the c++-libs
(because someone would have certainly noticed that before i did), but on the other hand i know for sure that i don't change the vector<CPlayer> in any way after assigning the "localplayer" iterator. i debugged the project line by line and can say that the exact place where the localplayer iterator becomes invalid is after a call to position.push_back(..) (where position is the
already mentioned CPlayer member of type vector<CPosition>). Please don't top post!
Do you have access to an access checking tool or debugger? If so, try it and see what happens.
i used the gdb was just what i wanted to say with "i debugged the project line by line".
janina
If not, post some code!
Ian
Stop trolling. If you still want help, post some code.
--
Regards,
Buster.
"Janina Kramer" <j.******@school-sucks.com> wrote:
[quoted text edited slightly for conciseness] i thought i could store a std::vector<CPlayer>::iterator "localplayer" that points to the respective element of the vector. The strange thing is that when i add elements to the std::vector<CPosition> the iterator "localplayer" becomes somehow invalid (in a way that the memory it points to is no longer the actual "localplayer" but rather some random position in memory). what's wrong here?
i know for sure that i don't change the vector<CPlayer> in any way after assigning the "localplayer" iterator. i debugged the project line by line and can say that the exact place where the localplayer iterator becomes invalid is after a call to position.push_back(..)
std::vector is required to store all of its items in a contiguous block
of memory. If you add a new item, and the vector is already 'full'
(ie. it is using all of the memory it has allocated so far), it has to
allocate new memory. Usually this involves allocating an entire new
large block of memory, copying all the values over, and releasing
the old memory. Obviously, this is why your iterators are now pointing
to the middle of nowhere.
You could either use a std::list (which allows insertion and deletion
without invalidating iterators/pointers/references), or keep using
a std::vector but call the "reserve()" member function beforehand.
This function pre-allocates memory for as many elements as you would
like, so that as long as you make sure the actual number of elements
doesn't exceed this limit, you can safely insert and delete without
invalidating your iterators.
On 12 Apr 2004 14:24:34 -0700, ol*****@inspire.net.nz (Old Wolf) wrote: std::vector is required to store all of its items in a contiguous block of memory. If you add a new item, and the vector is already 'full' (ie. it is using all of the memory it has allocated so far), it has to allocate new memory. Usually this involves allocating an entire new large block of memory, copying all the values over, and releasing the old memory. Obviously, this is why your iterators are now pointing to the middle of nowhere.
I think in this case we've been thinking about what would happen if there
were an iterator /to the vector/ that has just grown. Different issue. But
given that the OP still hasn't seen fit to post any /code/ to help us help
him with his problem, I'm not surprised you read it that way...
-leor
--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
"Leor Zolman" <le**@bdsoft.com> schrieb im Newsbeitrag news:ij********************************@4ax.com... On 12 Apr 2004 14:24:34 -0700, ol*****@inspire.net.nz (Old Wolf) wrote:
I think in this case we've been thinking about what would happen if there were an iterator /to the vector/ that has just grown. Different issue. But given that the OP still hasn't seen fit to post any /code/ to help us help him with his problem, I'm not surprised you read it that way... -leor
excuse me, but i really don't know what code i shall post here. the one that doesn't change the players-vector or the one that makes
the call to position.push_back(..) without influencing the players-vector in any way. both wouldn't make much sense, would it?
(might sound like a joke, but it's not)
janina -- Leor Zolman --- BD Software --- www.bdsoft.com On-Site Training in C/C++, Java, Perl and Unix C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
On Tue, 13 Apr 2004 00:33:52 +0200, "Janina Kramer"
<j.******@school-sucks.com> wrote: excuse me, but i really don't know what code i shall post here. the one that doesn't change the players-vector or the one that makes the call to position.push_back(..) without influencing the players-vector in any way. both wouldn't make much sense, would it? (might sound like a joke, but it's not)
I don't know what code you shall post either, but I suspect I know how much
additional help you shall receive if you post none at all (and that may in
fact be at least a /little/ bit a joke.)
-leor
--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jason Heyes |
last post by:
To my understanding, std::vector does not use reference counting to avoid
the overhead of copying and initialisation. Where can I get a reference
counted implementation of std::vector? Thanks.
|
by: Janina Kramer |
last post by:
hi ng,
i'm working on a multiplayer game for a variable number of players and on the client side, i'm using a std::vector<CPlayer> to store
informatik about the players. CPlayer is a class that...
|
by: Anonymous |
last post by:
Is there a non-brute force method of doing this?
transform() looked likely but had no predefined function object.
std::vector<double> src;
std::vector<int> dest;
...
|
by: Michael Hopkins |
last post by:
Hi all
I want to create a std::vector that goes from 1 to n instead of 0 to n-1.
The only change this will have is in loops and when the vector returns
positions of elements etc. I am calling...
|
by: Ross A. Finlayson |
last post by:
I'm trying to write some C code, but I want to use C++'s std::vector.
Indeed, if the code is compiled as C++, I want the container to
actually be std::vector, in this case of a collection of value...
|
by: zl2k |
last post by:
hi, c++ user
Suppose I constructed a large array and put it in the std::vector in a
function and now I want to return it back to where the function is called.
I can do like this:
...
|
by: Peter Olcott |
last post by:
I am trying to refer to the same std::vector in a class by two different names,
I tried a union, and I tried a reference, I can't seem to get the syntax right.
Can anyone please help? Thanks
|
by: aaragon |
last post by:
I am trying to create a vector of type T and everything goes fine until
I try to iterate over it. For some reason, the compiler gives me an
error when I declare
std::vector<T>::iterator iter;...
|
by: jubelbrus |
last post by:
Hi
I'm trying to do the following.
#include <vector>
#include <boost/thread/mutex.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>
class {
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
|
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...
|
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,...
| |