c++ - STL iterators and 'const' -
When I use the etherneters, I have a problem that appears to be some type of inserted molding. I'm not really sure which code is relevant (if I did then I probably would not ask this question.) Then I would do my best to describe my problem.
typedef set & lt; SmallObject & gt; Container; // Unconfigured zero videObject :: someFunction () {// const Container :: Not the Eaterator; // not for const (this = c. Beta (); it! = C.ed (); ++ this) {// value of "container" (* it is) .smallObjectFunction (); // one const function}}
However, I always get the following error:
Error: 'const smallobject' as 'this' argument Passing 'Intel Short Object: Small Object Function ()' Disclaims Qualifier
However, if I put it in the form of The only thing I can understand is In some way causes the iterator to return the components. Any help or explanation is here? ((SmallObject) (* it) I'm getting rid of the error message.
The Bull Operator & Lt; (const smallobject & amp; a) cones
Set and map order elements according to the order of the order. To break the inventory for user code, map key
and the entire set The element should be stable. Your problem is that the archived element is not SmallObject
, but const SmallObject
.
If it was not limited you might have:
int init [] = {1, 2, 3, 4, 5}; Std :: set & lt; Integer & gt; Value (init, init + 5); Std :: copy (values.begin (), values.end (), std :: ostream_iterator & lt; int & gt; (std :: cout, "")); // 1 2 3 4 5 * (values.find (3)) = 5; // Luckily this does not work! Std :: copy (values.begin (), values.end (), std :: ostream_iterator & lt; int & gt; (std :: cout, "")); // 1 2 5 4 5 - not in order !!!
The problem is not that the set element will now be in order, but that how the tree was made, there may be elements present, but can not exist in the set.
Comments
Post a Comment