YSTest: set.hpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

set.hpp
浏览该文件的文档.
1 /*
2 © 2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YB_INC_ystdex_set_hpp_
29 #define YB_INC_ystdex_set_hpp_ 1
30
31 #include "functor.hpp" // for lref, std::move, less, std::allocator,
32 // std::allocator_traits, std::piecewise_construct, enable_if_transparent,
33 // std::count, std::lower_bound, std::upper_bound, std::equal_range;
34 #include "iterator.hpp" // for transformed_iterator,
35 // iterator_transformation::second, ystdex::make_transform,
36 // std::forward_as_tuple;
37 #include <map> // for std::map, std::initializer_list;
38
39 namespace ystdex
40 {
41
47 template<typename _type>
48 yconstfn const _type&
49 set_value_move(const _type& x) ynothrow
50 {
51 return x;
52 }
53
54
55 // XXX: G++ 5.2.0 rejects generic associative lookup in debug mode of %std::map.
56 // TODO: Find precise version supporting debug mode.
57 #if (__cpp_lib_generic_associative_lookup >= 201304 || __cplusplus >= 201402L) \
58 && !(defined(__GLIBCXX__) && defined(_GLIBCXX_DEBUG))
59 # define YB_Impl_Set_UseGenericLookup 1
60 #else
61 # define YB_Impl_Set_GenericLookup 0
62 #endif
63
65 namespace details
66 {
67
69 template<typename _tWrappedKey, typename _fComp,
70 bool = has_mem_is_transparent<_fComp>::value>
71 struct tcompare
72 {
73 _fComp comp;
74
75 tcompare(_fComp c)
76 : comp(std::move(c))
77 {}
78
79 bool
80 operator()(const _tWrappedKey& x, const _tWrappedKey& y) const
81 {
82 return bool(comp(x.get(), y.get()));
83 }
84 };
85
87 template<typename _tWrappedKey, typename _fComp>
88 struct tcompare<_tWrappedKey, _fComp, true>
89 : private tcompare<_tWrappedKey, _fComp, false>
90 {
91 private:
92 using base = tcompare<_tWrappedKey, _fComp, false>;
93
94 public:
95 using is_transparent = yimpl(void);
96
97 using base::comp;
98
99 #if YB_IMPL_CLANGPP
100 // NOTE: See https://llvm.org/bugs/show_bug.cgi?id=27504.
101 using tcompare<_tWrappedKey, _fComp, false>::tcompare;
102 #else
103 using base::tcompare;
104 #endif
105
106 using base::operator();
107 template<typename _tKey>
108 bool
109 operator()(const _tWrappedKey& x, const _tKey& y) const
110 {
111 return bool(comp(x.get(), y));
112 }
113 template<typename _tKey>
114 bool
115 operator()(const _tKey& x, const _tWrappedKey& y) const
116 {
117 return bool(comp(x, y.get()));
118 }
119 };
120
121
122 template<typename _type>
123 class wrapped_key
124 {
125 public:
126 using key_type = _type;
127 using wrapper = lref<const key_type>;
128
129 private:
130 mutable wrapper k;
131
132 public:
133 wrapped_key(const key_type& key)
134 : k(key)
135 {}
136
137 void
138 amend(const _type& key) const ynothrow
139 {
140 k = wrapper(key);
141 }
142
143 const _type&
144 get() const ynothrow
145 {
146 return k;
147 }
148 };
149
150 } // namespace details;
151
158 template<typename _type, typename _fComp = less<_type>,
159 class _tAlloc = std::allocator<_type>>
160 class mapped_set
161 {
162 public:
163 using key_type = _type;
164 using value_type = _type;
165 using key_compare = _fComp;
166 using value_compare = _fComp;
167 using allocator_type = _tAlloc;
168 using reference = value_type&;
169 using const_reference = const value_type&;
170
171 private:
172 using mapped_key_type = details::wrapped_key<_type>;
173 using mapped_key_compare = details::tcompare<mapped_key_type, _fComp>;
174 using umap_type
175 = std::map<mapped_key_type, value_type, mapped_key_compare, _tAlloc>;
176 using umap_pair = typename umap_type::value_type;
177 // NOTE: Here %get_second cannot be used directory due to possible
178 // incomplete value type and requirement on conversion between
179 // 'const_iterator' and 'iterator'.
180 template<typename _tIter>
181 using wrap_iter
182 = transformed_iterator<_tIter, iterator_transformation::second<>>;
183
184 public:
185 using iterator = yimpl(wrap_iter<typename umap_type::iterator>);
186 using const_iterator = yimpl(wrap_iter<typename umap_type::const_iterator>);
187 using size_type = yimpl(typename umap_type::size_type);
188 using difference_type = yimpl(typename umap_type::difference_type);
189 using pointer = typename std::allocator_traits<_tAlloc>::pointer;
190 using const_pointer
191 = typename std::allocator_traits<_tAlloc>::const_pointer;
192 using reverse_iterator = std::reverse_iterator<iterator>;
193 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
194
195 private:
196 // XXX: It is undefined behavior when %value_type is incomplete, however
197 // some implementations actually supports this.
198 umap_type m_map;
199
200 public:
201 mapped_set()
202 : mapped_set(_fComp())
203 {}
204 explicit
205 mapped_set(const _fComp& comp, const _tAlloc& a = _tAlloc())
206 : m_map(comp, a)
207 {}
208 template<typename _tIn>
209 mapped_set(_tIn first, _tIn last, const _fComp& comp = _fComp(),
210 const _tAlloc& a = _tAlloc())
211 : m_map(ystdex::make_transform(first, iter_trans<_tIn>),
212 ystdex::make_transform(last, iter_trans<_tIn>), comp, a)
213 {
214 amend_all();
215 }
216 mapped_set(const mapped_set& s)
217 : m_map(s.m_map)
218 {
219 amend_all();
220 }
221 mapped_set(mapped_set&& s)
222 : m_map(std::move(s.m_map))
223 {
224 amend_all();
225 }
226 explicit
227 mapped_set(const _tAlloc& a)
228 : m_map(a)
229 {}
230 mapped_set(const mapped_set& s, const _tAlloc& a)
231 : m_map(s.m_map, a)
232 {
233 amend_all();
234 }
235 mapped_set(mapped_set&& s, const _tAlloc& a)
236 : m_map(std::move(s), a)
237 {
238 amend_all();
239 }
240 mapped_set(std::initializer_list<value_type> il,
241 const _fComp& comp = _fComp(), const _tAlloc& a = _tAlloc())
242 : mapped_set(il.begin(), il.end(), comp, a)
243 {}
244 template<typename _tIn>
245 mapped_set(_tIn first, _tIn last, const _tAlloc& a)
246 : mapped_set(first, last, _fComp(), a)
247 {}
248 mapped_set(std::initializer_list<value_type> il, const _tAlloc& a)
249 : mapped_set(il, _fComp(), a)
250 {}
251 ~mapped_set() yimpl(= default);
252
253 mapped_set&
254 operator=(const mapped_set& s)
255 {
256 mapped_set(s).swap(*this);
257 return *this;
258 }
259 mapped_set&
260 operator=(mapped_set&& s)
261 #if false
262 // TODO: Blocked. Apply exception specification after published ISO C++17.
263 ynoexcept(std::allocator_traits<_tAlloc>::is_always_equal()
264 && is_nothrow_move_assignable<_fComp>())
265 #endif
266 {
267 s.swap(*this);
268 return *this;
269 }
270 mapped_set&
271 operator=(std::initializer_list<value_type> il)
272 {
273 mapped_set(il).swap(*this);
274 return *this;
275 }
276
277 allocator_type
278 get_allocator() const ynothrow
279 {
280 return m_map.get_allocator();
281 }
282
283 iterator
284 begin() ynothrow
285 {
286 return iterator(m_map.begin());
287 }
288 const_iterator
289 begin() const ynothrow
290 {
291 return const_iterator(m_map.begin());
292 }
293
294 iterator
295 end() ynothrow
296 {
297 return iterator(m_map.end());
298 }
299 const_iterator
300 end() const ynothrow
301 {
302 return const_iterator(m_map.end());
303 }
304
305 reverse_iterator
306 rbegin() ynothrow
307 {
308 return reverse_iterator(end());
309 }
310 const_reverse_iterator
311 rbegin() const ynothrow
312 {
313 return const_reverse_iterator(end());
314 }
315
316 reverse_iterator
317 rend() ynothrow
318 {
319 return reverse_iterator(begin());
320 }
321 const_reverse_iterator
322 rend() const ynothrow
323 {
324 return const_reverse_iterator(begin());
325 }
326
327 const_iterator
328 cbegin() const ynothrow
329 {
330 return const_iterator(m_map.cbegin());
331 }
332
333 const_iterator
334 cend() const ynothrow
335 {
336 return const_iterator(m_map.cend());
337 }
338
339 const_reverse_iterator
340 crbegin() const ynothrow
341 {
342 return const_reverse_iterator(end());
343 }
344
345 const_reverse_iterator
346 crend() const ynothrow
347 {
348 return const_reverse_iterator(begin());
349 }
350
351 bool
352 empty() const ynothrow
353 {
354 return m_map.empty();
355 }
356
357 size_type
358 size() const ynothrow
359 {
360 return m_map.size();
361 }
362
363 size_type
364 max_size() const ynothrow
365 {
366 return m_map.max_size();
367 }
368
369 template<typename... _tParams>
370 std::pair<iterator, bool>
371 emplace(_tParams&&... args)
372 {
373 // XXX: %value_type needs to be MoveConstructible, not
374 // EmplaceInsertable.
375 return insert(value_type(yforward(args)...));
376 }
377
379 template<typename... _tParams>
380 iterator
381 emplace_hint(const_iterator position, _tParams&&... args)
382 {
383 // XXX: %value_type needs to be MoveConstructible, not
384 // EmplaceInsertable.
385 return insert(position, value_type(yforward(args)...));
386 }
387
388 std::pair<iterator, bool>
389 insert(const value_type& x)
390 {
391 // XXX: %value_type needs to be CopyConstructible rather than
392 // CopyInsertable into %mapped_set.
393 // XXX: %mapped_key_type and %value_type need to be EmplaceConstructible
394 // into %umap_type.
395 const auto res(m_map.emplace(std::piecewise_construct,
396 std::forward_as_tuple(mapped_key_type(x)),
397 std::forward_as_tuple(x)));
398
399 if(res.second)
400 amend_pair(*res.first);
401 return {iterator(res.first), res.second};
402 }
404 std::pair<iterator, bool>
405 insert(value_type&& x)
406 {
407 // XXX: %mapped_key_type and moved %value_type need to be
408 // EmplaceConstructible into %umap_type.
409 const auto res(m_map.emplace(std::piecewise_construct,
410 std::forward_as_tuple(mapped_key_type(x)),
411 std::forward_as_tuple(set_value_move(x))));
412
413 if(res.second)
414 amend_pair(*res.first);
415 return {iterator(res.first), res.second};
416 }
417 iterator
418 insert(const_iterator position, const value_type& x)
419 {
420 // XXX: %mapped_key_type and %value_type need to be EmplaceConstructible
421 // into %umap_type.
422 const auto res(m_map.emplace_hint(position.get(),
423 std::piecewise_construct, std::forward_as_tuple(mapped_key_type(x)),
424 std::forward_as_tuple(x)));
425
426 // TODO: Blocked. Use C++1z %try_emplace result.
427 amend_pair(*res);
428 return iterator(res);
429 }
431 iterator
432 insert(const_iterator position, value_type&& x)
433 {
434 // XXX: %mapped_key_type and moved %value_type need to be
435 // EmplaceConstructible into %umap_type.
436 const auto res(m_map.emplace_hint(position.get(),
437 std::piecewise_construct, std::forward_as_tuple(mapped_key_type(x)),
438 std::forward_as_tuple(set_value_move(x))));
439
440 // TODO: Blocked. Use C++1z %try_emplace result.
441 amend_pair(*res);
442 return iterator(res);
443 }
444 template<typename _tIn>
445 void
446 insert(_tIn first, _tIn last)
447 {
448 m_map.insert(ystdex::make_transform(first, iter_trans<_tIn>),
449 ystdex::make_transform(last, iter_trans<_tIn>));
450 // XXX: Time complexity.
451 amend_all();
452 }
453 void
454 insert(std::initializer_list<value_type> il)
455 {
456 insert(il.begin(), il.end());
457 }
458
459 iterator
460 erase(iterator position)
461 {
462 return iterator(m_map.erase(position.get()));
463 }
464 iterator
465 erase(const_iterator position)
466 {
467 return iterator(m_map.erase(position.get()));
468 }
469 size_type
470 erase(const key_type& x)
471 {
472 return m_map.erase(mapped_key_type(x));
473 }
474 iterator
475 erase(const_iterator first, const_iterator last)
476 {
477 return iterator(m_map.erase(first.get(), last.get()));
478 }
479
480 void
481 swap(mapped_set& s)
482 #if false
483 // TODO: Blocked. Apply exception specification after published ISO C++17.
484 ynoexcept(std::allocator_traits<_tAlloc>::is_always_equal()
485 && is_nothrow_swappable<_fComp>())
486 #endif
487 {
488 m_map.swap(s.m_map);
489 }
490
491 void
492 clear() ynothrow
493 {
494 m_map.clear();
495 }
496
497 key_compare
498 key_comp() const
499 {
500 return m_map.key_comp().comp;
501 }
502
503 value_compare
504 value_comp() const
505 {
506 return m_map.key_comp().comp;
507 }
508
509 #define YB_Impl_Set_GenericLookupHead(_n, _r) \
510 template<typename _tKey, \
511 yimpl(typename = enable_if_transparent_t<_fComp, _tKey>)> \
512 _r \
513 _n(const _tKey& x)
514
515 iterator
516 find(const key_type& x)
517 {
518 return iterator(m_map.find(mapped_key_type(x)));
519 }
520 const_iterator
521 find(const key_type& x) const
522 {
523 return const_iterator(m_map.find(mapped_key_type(x)));
524 }
526 YB_Impl_Set_GenericLookupHead(find, iterator)
527 {
528 #if YB_Impl_Set_UseGenericLookup
529 return iterator(m_map.find(x));
530 #else
531 const auto i(lower_bound(x));
532
533 return i != end() && !gcomp()(x, *i) ? i : end();
534 #endif
535 }
537 YB_Impl_Set_GenericLookupHead(find, const_iterator) const
538 {
539 #if YB_Impl_Set_UseGenericLookup
540 return const_iterator(m_map.find(x));
541 #else
542 const auto i(lower_bound(x));
543
544 return i != cend() && !gcomp()(x, *i) ? i : cend();
545 #endif
546 }
547
548 size_type
549 count(const key_type& x) const
550 {
551 return m_map.count(mapped_key_type(x));
552 }
553 YB_Impl_Set_GenericLookupHead(count, size_type) const
554 {
555 #if YB_Impl_Set_UseGenericLookup
556 return m_map.count(x);
557 #else
558 const auto pr(equal_range(x));
559
560 return std::count(pr.first, pr.second, gcomp());
561 #endif
562 }
563
564 iterator
565 lower_bound(const key_type& x)
566 {
567 return iterator(m_map.lower_bound(mapped_key_type(x)));
568 }
569 const_iterator
570 lower_bound(const key_type& x) const
571 {
572 return const_iterator(m_map.lower_bound(mapped_key_type(x)));
573 }
575 YB_Impl_Set_GenericLookupHead(lower_bound, iterator)
576 {
577 #if YB_Impl_Set_UseGenericLookup
578 return iterator(m_map.lower_bound(x));
579 #else
580 return std::lower_bound(begin(), end(), x, gcomp());
581 #endif
582 }
584 YB_Impl_Set_GenericLookupHead(lower_bound, const_iterator) const
585 {
586 #if YB_Impl_Set_UseGenericLookup
587 return const_iterator(m_map.lower_bound(x));
588 #else
589 return std::lower_bound(cbegin(), cend(), x, gcomp());
590 #endif
591 }
592
593 iterator
594 upper_bound(const key_type& x)
595 {
596 return iterator(m_map.upper_bound(mapped_key_type(x)));
597 }
598 const_iterator
599 upper_bound(const key_type& x) const
600 {
601 return const_iterator(m_map.upper_bound(mapped_key_type(x)));
602 }
604 YB_Impl_Set_GenericLookupHead(upper_bound, iterator)
605 {
606 #if YB_Impl_Set_UseGenericLookup
607 return iterator(m_map.upper_bound(x));
608 #else
609 return std::upper_bound(begin(), end(), x, gcomp());
610 #endif
611 }
613 YB_Impl_Set_GenericLookupHead(upper_bound, const_iterator) const
614 {
615 #if YB_Impl_Set_UseGenericLookup
616 return const_iterator(m_map.upper_bound(x));
617 #else
618 return std::upper_bound(cbegin(), cend(), x, gcomp());
619 #endif
620 }
621
622 std::pair<iterator, iterator>
623 equal_range(const key_type& x)
624 {
625 const auto pr(m_map.equal_range(mapped_key_type(x)));
626
627 return {iterator(pr.first), iterator(pr.second)};
628 }
629 std::pair<const_iterator, const_iterator>
630 equal_range(const key_type& x) const
631 {
632 const auto pr(m_map.equal_range(mapped_key_type(x)));
633
634 return {const_iterator(pr.first), const_iterator(pr.second)};
635 }
637 YB_Impl_Set_GenericLookupHead(equal_range,
638 std::pair<iterator YPP_Comma iterator>)
639 {
640 #if YB_Impl_Set_UseGenericLookup
641 const auto pr(m_map.equal_range(x));
642
643 return {iterator(x.first), iterator(x.second)};
644 #else
645 return std::equal_range(begin(), end(), x, gcomp());
646 #endif
647 }
649 YB_Impl_Set_GenericLookupHead(equal_range,
650 std::pair<const_iterator YPP_Comma const_iterator>) const
651 {
652 #if YB_Impl_Set_UseGenericLookup
653 const auto pr(m_map.equal_range(x));
654
655 return {const_iterator(x.first), const_iterator(x.second)};
656 #else
657 return std::equal_range(cbegin(), cend(), x, gcomp());
658 #endif
659 }
660 #undef YB_Impl_Set_GenericLookupHead
661
662 private:
663 void
664 amend_all() const
665 {
666 for(const auto& pr : m_map)
667 amend_pair(pr);
668 }
669
670 static void
671 amend_pair(const umap_pair& pr) ynothrow
672 {
673 pr.first.amend(pr.second);
674 }
675
676 #if !YB_Impl_Set_UseGenericLookup
677 mapped_key_compare
679 gcomp() const
680 {
681 return m_map.key_comp();
682 }
683 #endif
684
685 template<typename _tIter>
686 static umap_pair
687 iter_trans(const _tIter& i)
688 {
689 return {mapped_key_type(*i), *i};
690 }
691 };
692
693 #undef YB_Impl_Set_UseGenericLookup
694
695 } // namespace ystdex;
696
697 #endif
698
ystdex::mapped_set::begin
iterator begin()
Definition: set.hpp:284
ystdex::mapped_set::begin
const_iterator begin() const
Definition: set.hpp:289
ystdex::mapped_set::crend
const_reverse_iterator crend() const
Definition: set.hpp:346
ystdex::mapped_set::erase
size_type erase(const key_type &x)
Definition: set.hpp:470
ystdex::mapped_set::value_comp
value_compare value_comp() const
Definition: set.hpp:504
YSLib::Drawing::x
The boundary is out of the const Rect SDst SPos x
Definition: YDraw.h:127
ystdex::mapped_set::max_size
size_type max_size() const
Definition: set.hpp:364
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:740
ystdex::details::tcompare::operator()
bool operator()(const _tWrappedKey &x, const _tWrappedKey &y) const
Definition: set.hpp:80
ystdex::details::tcompare::comp
_fComp comp
Definition: set.hpp:73
ystdex::details::tcompare< _tWrappedKey, _fComp, true >::is_transparent
void is_transparent
Definition: set.hpp:95
ystdex::mapped_set::cbegin
const_iterator cbegin() const
Definition: set.hpp:328
ystdex::mapped_set::reference
value_type & reference
Definition: set.hpp:168
ystdex::set_value_move
const _type & set_value_move(const _type &x)
转移集合元素。
Definition: set.hpp:49
iterator.hpp
通用迭代器。
ystdex::mapped_set::const_reference
const value_type & const_reference
Definition: set.hpp:169
ystdex::mapped_set::umap_type
std::map< mapped_key_type, value_type, mapped_key_compare, _tAlloc > umap_type
Definition: set.hpp:175
ystdex::mapped_set::m_map
umap_type m_map
Definition: set.hpp:198
ystdex::details::wrapped_key::k
wrapper k
Definition: set.hpp:130
ystdex::mapped_set::equal_range
std::pair< iterator, iterator > equal_range(const key_type &x)
Definition: set.hpp:623
ystdex::mapped_set::rend
reverse_iterator rend()
Definition: set.hpp:317
ystdex::mapped_set::~mapped_set
~mapped_set()=default
ystdex::mapped_set::mapped_set
mapped_set(std::initializer_list< value_type > il, const _fComp &comp=_fComp(), const _tAlloc &a=_tAlloc())
Definition: set.hpp:240
ystdex::mapped_set::insert
void insert(_tIn first, _tIn last)
Definition: set.hpp:446
ystdex::mapped_set::mapped_set
mapped_set(std::initializer_list< value_type > il, const _tAlloc &a)
Definition: set.hpp:248
ystdex::mapped_set::size
size_type size() const
Definition: set.hpp:358
ystdex::mapped_set::pointer
typename std::allocator_traits< _tAlloc >::pointer pointer
Definition: set.hpp:189
ystdex::mapped_set::erase
iterator erase(iterator position)
Definition: set.hpp:460
ystdex::details::wrapped_key::wrapper
lref< const key_type > wrapper
Definition: set.hpp:127
ystdex::mapped_set::get_allocator
allocator_type get_allocator() const
Definition: set.hpp:278
ystdex::mapped_set::const_pointer
typename std::allocator_traits< _tAlloc >::const_pointer const_pointer
Definition: set.hpp:191
ystdex::mapped_set::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: set.hpp:192
ystdex::mapped_set::insert
iterator insert(const_iterator position, value_type &&x)
Definition: set.hpp:432
ystdex::mapped_set::find
iterator find(const key_type &x)
Definition: set.hpp:516
ystdex::mapped_set::insert
void insert(std::initializer_list< value_type > il)
Definition: set.hpp:454
ystdex::mapped_set::empty
bool empty() const
Definition: set.hpp:352
ystdex::details::wrapped_key::wrapped_key
wrapped_key(const key_type &key)
Definition: set.hpp:133
ystdex::details::tcompare< _tWrappedKey, _fComp, true >::operator()
bool operator()(const _tWrappedKey &x, const _tKey &y) const
Definition: set.hpp:109
ystdex::details::wrapped_key::amend
void amend(const _type &key) const
Definition: set.hpp:138
ystdex::mapped_set::amend_pair
static void amend_pair(const umap_pair &pr)
Definition: set.hpp:671
ystdex::mapped_set::mapped_set
mapped_set(mapped_set &&s)
Definition: set.hpp:221
CHRLib::c
c
Definition: CharacterProcessing.h:81
ystdex::mapped_set::upper_bound
const_iterator upper_bound(const key_type &x) const
Definition: set.hpp:599
ystdex::is_nothrow_swappable
Definition: type_traits.hpp:530
ystdex::mapped_set::mapped_set
mapped_set(mapped_set &&s, const _tAlloc &a)
Definition: set.hpp:235
ystdex::mapped_set
允许指定不同于值类型的键的集合。
Definition: set.hpp:160
ystdex::lref< const key_type >
yimpl
#define yimpl(...)
实现标签。
Definition: ydef.h:256
ystdex::mapped_set::key_compare
_fComp key_compare
Definition: set.hpp:165
ystdex::mapped_set::lower_bound
iterator lower_bound(const key_type &x)
Definition: set.hpp:565
ystdex::mapped_set::insert
iterator insert(const_iterator position, const value_type &x)
Definition: set.hpp:418
ystdex::details::wrapped_key::key_type
_type key_type
Definition: set.hpp:126
ystdex::mapped_set::insert
std::pair< iterator, bool > insert(value_type &&x)
Definition: set.hpp:405
ystdex::mapped_set::lower_bound
const_iterator lower_bound(const key_type &x) const
Definition: set.hpp:570
ystdex::mapped_set::value_compare
_fComp value_compare
Definition: set.hpp:166
ystdex::mapped_set::iterator
wrap_iter< typename umap_type::iterator > iterator
Definition: set.hpp:185
ystdex::mapped_set::erase
iterator erase(const_iterator position)
Definition: set.hpp:465
ystdex::mapped_set::find
const_iterator find(const key_type &x) const
Definition: set.hpp:521
YB_Impl_Set_GenericLookupHead
#define YB_Impl_Set_GenericLookupHead(_n, _r)
Definition: set.hpp:509
std
Definition: memory.hpp:1100
ystdex::mapped_set::swap
void swap(mapped_set &s)
Definition: set.hpp:481
ystdex::mapped_set::size_type
typename umap_type::size_type size_type
Definition: set.hpp:187
ystdex::mapped_set::emplace_hint
iterator emplace_hint(const_iterator position, _tParams &&...args)
Definition: set.hpp:381
ystdex::mapped_set::count
size_type count(const key_type &x) const
Definition: set.hpp:549
ystdex::details::tcompare< _tWrappedKey, _fComp, true >::operator()
bool operator()(const _tKey &x, const _tWrappedKey &y) const
Definition: set.hpp:115
ystdex::mapped_set::key_type
_type key_type
Definition: set.hpp:163
ystdex::mapped_set::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: set.hpp:193
ystdex::mapped_set::operator=
mapped_set & operator=(mapped_set &&s)
Definition: set.hpp:260
ystdex::mapped_set::erase
iterator erase(const_iterator first, const_iterator last)
Definition: set.hpp:475
ystdex
特性测试宏。
Definition: ydef.h:796
ystdex::mapped_set::mapped_key_compare
details::tcompare< mapped_key_type, _fComp > mapped_key_compare
Definition: set.hpp:173
functor.hpp
通用仿函数。
ystdex::mapped_set::crbegin
const_reverse_iterator crbegin() const
Definition: set.hpp:340
ystdex::mapped_set::mapped_set
mapped_set(const _fComp &comp, const _tAlloc &a=_tAlloc())
Definition: set.hpp:205
ystdex::mapped_set::end
iterator end()
Definition: set.hpp:295
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
ystdex::mapped_set::mapped_key_type
details::wrapped_key< _type > mapped_key_type
Definition: set.hpp:172
YSLib::i
return i
Definition: YCoreUtilities.h:176
ystdex::mapped_set::allocator_type
_tAlloc allocator_type
Definition: set.hpp:167
ystdex::mapped_set::const_iterator
wrap_iter< typename umap_type::const_iterator > const_iterator
Definition: set.hpp:186
ystdex::mapped_set::value_type
_type value_type
Definition: set.hpp:164
ystdex::mapped_set::operator=
mapped_set & operator=(std::initializer_list< value_type > il)
Definition: set.hpp:271
ystdex::mapped_set::end
const_iterator end() const
Definition: set.hpp:300
ynoexcept
#define ynoexcept(...)
YSLib 无异常抛出保证：指定特定的异常规范。
Definition: ydef.h:720
ystdex::mapped_set::difference_type
typename umap_type::difference_type difference_type
Definition: set.hpp:188
ystdex::mapped_set::key_comp
key_compare key_comp() const
Definition: set.hpp:498
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:654
ystdex::mapped_set::mapped_set
mapped_set(_tIn first, _tIn last, const _fComp &comp=_fComp(), const _tAlloc &a=_tAlloc())
Definition: set.hpp:209
ystdex::mapped_set::mapped_set
mapped_set(const mapped_set &s)
Definition: set.hpp:216
ystdex::mapped_set::iter_trans
static umap_pair iter_trans(const _tIter &i)
Definition: set.hpp:687
YSLib::a
YB_PURE const _type * a
Definition: YCoreUtilities.h:167
ystdex::mapped_set::rbegin
const_reverse_iterator rbegin() const
Definition: set.hpp:311
ystdex::mapped_set::mapped_set
mapped_set(const mapped_set &s, const _tAlloc &a)
Definition: set.hpp:230
ystdex::details::tcompare
Definition: set.hpp:71
ystdex::mapped_set::mapped_set
mapped_set(_tIn first, _tIn last, const _tAlloc &a)
Definition: set.hpp:245
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:969
ystdex::mapped_set::upper_bound
iterator upper_bound(const key_type &x)
Definition: set.hpp:594
ystdex::mapped_set::mapped_set
mapped_set()
Definition: set.hpp:201
ystdex::transformed_iterator::get
iterator_type & get()
取原迭代器引用。
Definition: iterator.hpp:441
ystdex::mapped_set::gcomp
mapped_key_compare gcomp() const
Definition: set.hpp:679
ystdex::mapped_set::umap_pair
typename umap_type::value_type umap_pair
Definition: set.hpp:176
ystdex::details::tcompare::tcompare
tcompare(_fComp c)
Definition: set.hpp:75
CHRLib::args
_tParams && args
Definition: CharacterProcessing.h:538
ystdex::mapped_set::clear
void clear()
Definition: set.hpp:492
ystdex::mapped_set::insert
std::pair< iterator, bool > insert(const value_type &x)
Definition: set.hpp:389
ystdex::mapped_set::emplace
std::pair< iterator, bool > emplace(_tParams &&...args)
Definition: set.hpp:371
ystdex::mapped_set::equal_range
std::pair< const_iterator, const_iterator > equal_range(const key_type &x) const
Definition: set.hpp:630
ystdex::details::wrapped_key
Definition: set.hpp:123
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
platform::bool
std::FILE *fp bool
Definition: FileIO.h:1187
ystdex::mapped_set::rend
const_reverse_iterator rend() const
Definition: set.hpp:322
ystdex::mapped_set::mapped_set
mapped_set(const _tAlloc &a)
Definition: set.hpp:227
ystdex::mapped_set::amend_all
void amend_all() const
Definition: set.hpp:664
ystdex::mapped_set::rbegin
reverse_iterator rbegin()
Definition: set.hpp:306
ystdex::transformed_iterator
变换迭代器。
Definition: iterator.hpp:216
ystdex::mapped_set::cend
const_iterator cend() const
Definition: set.hpp:334