mirror of
https://github.com/boostorg/container.git
synced 2025-08-05 15:24:31 +02:00
Added explicit guarantee for iterators to containers of incomplete types. Added iterators to the recursive container example.
This commit is contained in:
@@ -162,6 +162,9 @@ it statically allocates memory for `value_type` and this requires complete types
|
|||||||
[classref boost::container::basic_string basic_string] implements Small String Optimization which
|
[classref boost::container::basic_string basic_string] implements Small String Optimization which
|
||||||
also requires complete types.
|
also requires complete types.
|
||||||
|
|
||||||
|
[*Boost.Container] containers supporting incomplete types also support instantiating iterators to
|
||||||
|
those incomplete elements.
|
||||||
|
|
||||||
[section:recursive_containers Recursive containers]
|
[section:recursive_containers Recursive containers]
|
||||||
|
|
||||||
Most [*Boost.Container] containers can be used to define recursive containers:
|
Most [*Boost.Container] containers can be used to define recursive containers:
|
||||||
@@ -1059,6 +1062,7 @@ use [*Boost.Container]? There are several reasons for that:
|
|||||||
* Added support for `initializer_list`. Contributed by Robert Matusewicz.
|
* Added support for `initializer_list`. Contributed by Robert Matusewicz.
|
||||||
* Fixed bugs:
|
* Fixed bugs:
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/10263 Trac #10263 (['"AIX 6.1 bug with sched_yield() function out of scope"])].
|
* [@https://svn.boost.org/trac/boost/ticket/10263 Trac #10263 (['"AIX 6.1 bug with sched_yield() function out of scope"])].
|
||||||
|
* [@https://github.com/boostorg/container/pull/16 GitHub #16: ['Fix iterators of incomplete type containers]]. Thanks to Mikael Persson.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
@@ -24,14 +24,19 @@ struct data
|
|||||||
int i_;
|
int i_;
|
||||||
//A vector holding still undefined class 'data'
|
//A vector holding still undefined class 'data'
|
||||||
vector<data> v_;
|
vector<data> v_;
|
||||||
|
vector<data>::iterator vi_;
|
||||||
//A stable_vector holding still undefined class 'data'
|
//A stable_vector holding still undefined class 'data'
|
||||||
stable_vector<data> sv_;
|
stable_vector<data> sv_;
|
||||||
|
stable_vector<data>::iterator svi_;
|
||||||
//A stable_vector holding still undefined class 'data'
|
//A stable_vector holding still undefined class 'data'
|
||||||
deque<data> d_;
|
deque<data> d_;
|
||||||
|
deque<data>::iterator di_;
|
||||||
//A list holding still undefined 'data'
|
//A list holding still undefined 'data'
|
||||||
list<data> l_;
|
list<data> l_;
|
||||||
|
list<data>::iterator li_;
|
||||||
//A map holding still undefined 'data'
|
//A map holding still undefined 'data'
|
||||||
map<data, data> m_;
|
map<data, data> m_;
|
||||||
|
map<data, data>::iterator mi_;
|
||||||
|
|
||||||
friend bool operator <(const data &l, const data &r)
|
friend bool operator <(const data &l, const data &r)
|
||||||
{ return l.i_ < r.i_; }
|
{ return l.i_ < r.i_; }
|
||||||
@@ -43,7 +48,8 @@ struct tree_node
|
|||||||
string value;
|
string value;
|
||||||
|
|
||||||
//children nodes of this node
|
//children nodes of this node
|
||||||
list<tree_node> children_;
|
list<tree_node> children_;
|
||||||
|
list<tree_node>::iterator selected_child_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +66,7 @@ int main()
|
|||||||
root.name = "root";
|
root.name = "root";
|
||||||
root.value = "root_value";
|
root.value = "root_value";
|
||||||
root.children_.resize(7);
|
root.children_.resize(7);
|
||||||
|
root.selected_child_ = root.children_.begin();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
|
Reference in New Issue
Block a user