Fixed hollow iterator, but it still breaks inlining.
This commit is contained in:
parent
48155e5b66
commit
ea1cb4709e
@ -59,10 +59,10 @@ struct hollow_iterator_base
|
||||
};
|
||||
|
||||
template <typename container_type, typename iterator> auto make_hollow(
|
||||
container_type* v, vector<bool>* p, iterator it) ->
|
||||
hollow_iterator_base<iterator, is_empty<container_type>> {
|
||||
return hollow_iterator_base<iterator, is_empty<container_type>>(
|
||||
it, is_empty<container_type>(v, p));
|
||||
container_type* v, const vector<bool>* p, iterator it) ->
|
||||
hollow_iterator_base<iterator, is_empty<const container_type>> {
|
||||
return hollow_iterator_base<iterator, is_empty<const container_type>>(
|
||||
it, is_empty<const container_type>(v, p));
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
||||
|
@ -30,6 +30,10 @@ int main(int argc, char** argv) {
|
||||
for (auto it = cbegin; it != cend; ++it) {
|
||||
if (((*it) % 2) != 0) exit(-1);
|
||||
}
|
||||
const vector<bool>* cp(&p);
|
||||
cbegin = make_hollow(cv, cp, v.begin());
|
||||
cend = make_hollow(cv, cp, cv->end());
|
||||
|
||||
vector<int>::iterator vit1 = v.begin();
|
||||
vector<int>::const_iterator vit2 = v.begin();
|
||||
if (vit1 != vit2) exit(-1);
|
||||
@ -37,7 +41,7 @@ int main(int argc, char** argv) {
|
||||
auto it2 = make_hollow(&v, &p, vit2);
|
||||
if (it1 != it2) exit(-1);
|
||||
|
||||
typedef is_empty<vector<int>> iev;
|
||||
typedef is_empty<const vector<int>> iev;
|
||||
hollow_iterator_base<vector<int>::iterator, iev> default_constructed;
|
||||
default_constructed = make_hollow(&v, &p, v.begin());
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user