YSTest: set.hpp 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

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

- 文件列表
- 文件成员

set.hpp
浏览该文件的文档.
1 /*
2 © 2016-2017 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_UseGenericLookup 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 support 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 // NOTE: ISO C++ allows the underlying associative container to throw on
223 // move.
224 yimpl(ynoexcept(is_nothrow_move_constructible<umap_type>()))
225 : m_map(std::move(s.m_map))
226 {
227 amend_all();
228 }
229 explicit
230 mapped_set(const _tAlloc& a)
231 : m_map(a)
232 {}
233 mapped_set(const mapped_set& s, const _tAlloc& a)
234 : m_map(s.m_map, a)
235 {
236 amend_all();
237 }
238 mapped_set(mapped_set&& s, const _tAlloc& a)
239 : m_map(std::move(s.m_map), a)
240 {
241 amend_all();
242 }
243 mapped_set(std::initializer_list<value_type> il,
244 const _fComp& comp = _fComp(), const _tAlloc& a = _tAlloc())
245 : mapped_set(il.begin(), il.end(), comp, a)
246 {}
247 template<typename _tIn>
248 mapped_set(_tIn first, _tIn last, const _tAlloc& a)
249 : mapped_set(first, last, _fComp(), a)
250 {}
251 mapped_set(std::initializer_list<value_type> il, const _tAlloc& a)
252 : mapped_set(il, _fComp(), a)
253 {}
254 ~mapped_set() yimpl(= default);
255
256 mapped_set&
257 operator=(const mapped_set& s)
258 {
259 // NOTE: The underlying implementation may reuse node, e.g. libstdc++.
260 // So it is preferred to directly move and then to fix references.
261 m_map = s.m_map;
262 amend_all();
263 return *this;
264 }
265 mapped_set&
266 operator=(mapped_set&& s)
267 #if false
268 // TODO: Blocked. Apply exception specification after published ISO C++17.
269 ynoexcept(std::allocator_traits<_tAlloc>::is_always_equal()
270 && is_nothrow_move_assignable<_fComp>())
271 #endif
272 {
273 s.swap(*this);
274 return *this;
275 }
276 mapped_set&
277 operator=(std::initializer_list<value_type> il)
278 {
279 mapped_set(il).swap(*this);
280 return *this;
281 }
282
283 allocator_type
284 get_allocator() const ynothrow
285 {
286 return m_map.get_allocator();
287 }
288
289 iterator
290 begin() ynothrow
291 {
292 return iterator(m_map.begin());
293 }
294 const_iterator
295 begin() const ynothrow
296 {
297 return const_iterator(m_map.begin());
298 }
299
300 iterator
301 end() ynothrow
302 {
303 return iterator(m_map.end());
304 }
305 const_iterator
306 end() const ynothrow
307 {
308 return const_iterator(m_map.end());
309 }
310
311 reverse_iterator
312 rbegin() ynothrow
313 {
314 return reverse_iterator(end());
315 }
316 const_reverse_iterator
317 rbegin() const ynothrow
318 {
319 return const_reverse_iterator(end());
320 }
321
322 reverse_iterator
323 rend() ynothrow
324 {
325 return reverse_iterator(begin());
326 }
327 const_reverse_iterator
328 rend() const ynothrow
329 {
330 return const_reverse_iterator(begin());
331 }
332
333 const_iterator
334 cbegin() const ynothrow
335 {
336 return const_iterator(m_map.cbegin());
337 }
338
339 const_iterator
340 cend() const ynothrow
341 {
342 return const_iterator(m_map.cend());
343 }
344
345 const_reverse_iterator
346 crbegin() const ynothrow
347 {
348 return const_reverse_iterator(end());
349 }
350
351 const_reverse_iterator
352 crend() const ynothrow
353 {
354 return const_reverse_iterator(begin());
355 }
356
357 bool
358 empty() const ynothrow
359 {
360 return m_map.empty();
361 }
362
363 size_type
364 size() const ynothrow
365 {
366 return m_map.size();
367 }
368
369 size_type
370 max_size() const ynothrow
371 {
372 return m_map.max_size();
373 }
374
375 template<typename... _tParams>
376 std::pair<iterator, bool>
377 emplace(_tParams&&... args)
378 {
379 // XXX: %value_type needs to be MoveConstructible, not
380 // EmplaceInsertable.
381 return insert(value_type(yforward(args)...));
382 }
383
385 template<typename... _tParams>
386 iterator
387 emplace_hint(const_iterator position, _tParams&&... args)
388 {
389 // XXX: %value_type needs to be MoveConstructible, not
390 // EmplaceInsertable.
391 return insert(position, value_type(yforward(args)...));
392 }
393
394 std::pair<iterator, bool>
395 insert(const value_type& x)
396 {
397 // XXX: %value_type needs to be CopyConstructible rather than
398 // CopyInsertable into %mapped_set.
399 // XXX: %mapped_key_type and %value_type need to be EmplaceConstructible
400 // into %umap_type.
401 const auto res(m_map.emplace(std::piecewise_construct,
402 std::forward_as_tuple(mapped_key_type(x)),
403 std::forward_as_tuple(x)));
404
405 if(res.second)
406 amend_pair(*res.first);
407 return {iterator(res.first), res.second};
408 }
410 std::pair<iterator, bool>
411 insert(value_type&& x)
412 {
413 // XXX: %mapped_key_type and moved %value_type need to be
414 // EmplaceConstructible into %umap_type.
415 const auto res(m_map.emplace(std::piecewise_construct,
416 std::forward_as_tuple(mapped_key_type(x)),
417 std::forward_as_tuple(set_value_move(x))));
418
419 if(res.second)
420 amend_pair(*res.first);
421 return {iterator(res.first), res.second};
422 }
423 iterator
424 insert(const_iterator position, const value_type& x)
425 {
426 // XXX: %mapped_key_type and %value_type need to be EmplaceConstructible
427 // into %umap_type.
428 const auto res(m_map.emplace_hint(position.get(),
429 std::piecewise_construct, std::forward_as_tuple(mapped_key_type(x)),
430 std::forward_as_tuple(x)));
431
432 // TODO: Blocked. Use C++1z %try_emplace result.
433 amend_pair(*res);
434 return iterator(res);
435 }
437 iterator
438 insert(const_iterator position, value_type&& x)
439 {
440 // XXX: %mapped_key_type and moved %value_type need to be
441 // EmplaceConstructible into %umap_type.
442 const auto res(m_map.emplace_hint(position.get(),
443 std::piecewise_construct, std::forward_as_tuple(mapped_key_type(x)),
444 std::forward_as_tuple(set_value_move(x))));
445
446 // TODO: Blocked. Use C++1z %try_emplace result.
447 amend_pair(*res);
448 return iterator(res);
449 }
450 template<typename _tIn>
451 void
452 insert(_tIn first, _tIn last)
453 {
454 m_map.insert(ystdex::make_transform(first, iter_trans<_tIn>),
455 ystdex::make_transform(last, iter_trans<_tIn>));
456 // XXX: Time complexity.
457 amend_all();
458 }
459 void
460 insert(std::initializer_list<value_type> il)
461 {
462 insert(il.begin(), il.end());
463 }
464
465 iterator
466 erase(iterator position)
467 {
468 return iterator(m_map.erase(position.get()));
469 }
470 iterator
471 erase(const_iterator position)
472 {
473 return iterator(m_map.erase(position.get()));
474 }
475 size_type
476 erase(const key_type& x)
477 {
478 return m_map.erase(mapped_key_type(x));
479 }
480 iterator
481 erase(const_iterator first, const_iterator last)
482 {
483 return iterator(m_map.erase(first.get(), last.get()));
484 }
485
486 void
487 swap(mapped_set& s)
488 #if false
489 // TODO: Blocked. Apply exception specification after published ISO C++17.
490 ynoexcept(std::allocator_traits<_tAlloc>::is_always_equal()
491 && is_nothrow_swappable<_fComp>())
492 #endif
493 {
494 m_map.swap(s.m_map);
495 }
496
497 void
498 clear() ynothrow
499 {
500 m_map.clear();
501 }
502
503 key_compare
504 key_comp() const
505 {
506 return m_map.key_comp().comp;
507 }
508
509 value_compare
510 value_comp() const
511 {
512 return m_map.key_comp().comp;
513 }
514
515 #define YB_Impl_Set_GenericLookupHead(_n, _r) \
516 template<typename _tKey, \
517 yimpl(typename = enable_if_transparent_t<_fComp, _tKey>)> \
518 _r \
519 _n(const _tKey& x)
520
521 iterator
522 find(const key_type& x)
523 {
524 return iterator(m_map.find(mapped_key_type(x)));
525 }
526 const_iterator
527 find(const key_type& x) const
528 {
529 return const_iterator(m_map.find(mapped_key_type(x)));
530 }
532 YB_Impl_Set_GenericLookupHead(find, iterator)
533 {
534 #if YB_Impl_Set_UseGenericLookup
535 return iterator(m_map.find(x));
536 #else
537 const auto i(lower_bound(x));
538
539 return i != end() && !gcomp()(x, *i) ? i : end();
540 #endif
541 }
543 YB_Impl_Set_GenericLookupHead(find, const_iterator) const
544 {
545 #if YB_Impl_Set_UseGenericLookup
546 return const_iterator(m_map.find(x));
547 #else
548 const auto i(lower_bound(x));
549
550 return i != cend() && !gcomp()(x, *i) ? i : cend();
551 #endif
552 }
553
554 size_type
555 count(const key_type& x) const
556 {
557 return m_map.count(mapped_key_type(x));
558 }
559 YB_Impl_Set_GenericLookupHead(count, size_type) const
560 {
561 #if YB_Impl_Set_UseGenericLookup
562 return m_map.count(x);
563 #else
564 const auto pr(equal_range(x));
565
566 return std::count(pr.first, pr.second, gcomp());
567 #endif
568 }
569
570 iterator
571 lower_bound(const key_type& x)
572 {
573 return iterator(m_map.lower_bound(mapped_key_type(x)));
574 }
575 const_iterator
576 lower_bound(const key_type& x) const
577 {
578 return const_iterator(m_map.lower_bound(mapped_key_type(x)));
579 }
581 YB_Impl_Set_GenericLookupHead(lower_bound, iterator)
582 {
583 #if YB_Impl_Set_UseGenericLookup
584 return iterator(m_map.lower_bound(x));
585 #else
586 return std::lower_bound(begin(), end(), x, gcomp());
587 #endif
588 }
590 YB_Impl_Set_GenericLookupHead(lower_bound, const_iterator) const
591 {
592 #if YB_Impl_Set_UseGenericLookup
593 return const_iterator(m_map.lower_bound(x));
594 #else
595 return std::lower_bound(cbegin(), cend(), x, gcomp());
596 #endif
597 }
598
599 iterator
600 upper_bound(const key_type& x)
601 {
602 return iterator(m_map.upper_bound(mapped_key_type(x)));
603 }
604 const_iterator
605 upper_bound(const key_type& x) const
606 {
607 return const_iterator(m_map.upper_bound(mapped_key_type(x)));
608 }
610 YB_Impl_Set_GenericLookupHead(upper_bound, iterator)
611 {
612 #if YB_Impl_Set_UseGenericLookup
613 return iterator(m_map.upper_bound(x));
614 #else
615 return std::upper_bound(begin(), end(), x, gcomp());
616 #endif
617 }
619 YB_Impl_Set_GenericLookupHead(upper_bound, const_iterator) const
620 {
621 #if YB_Impl_Set_UseGenericLookup
622 return const_iterator(m_map.upper_bound(x));
623 #else
624 return std::upper_bound(cbegin(), cend(), x, gcomp());
625 #endif
626 }
627
628 std::pair<iterator, iterator>
629 equal_range(const key_type& x)
630 {
631 const auto pr(m_map.equal_range(mapped_key_type(x)));
632
633 return {iterator(pr.first), iterator(pr.second)};
634 }
635 std::pair<const_iterator, const_iterator>
636 equal_range(const key_type& x) const
637 {
638 const auto pr(m_map.equal_range(mapped_key_type(x)));
639
640 return {const_iterator(pr.first), const_iterator(pr.second)};
641 }
643 YB_Impl_Set_GenericLookupHead(equal_range,
644 std::pair<iterator YPP_Comma iterator>)
645 {
646 #if YB_Impl_Set_UseGenericLookup
647 const auto pr(m_map.equal_range(x));
648
649 return {iterator(pr.first), iterator(pr.second)};
650 #else
651 return std::equal_range(begin(), end(), x, gcomp());
652 #endif
653 }
655 YB_Impl_Set_GenericLookupHead(equal_range,
656 std::pair<const_iterator YPP_Comma const_iterator>) const
657 {
658 #if YB_Impl_Set_UseGenericLookup
659 const auto pr(m_map.equal_range(x));
660
661 return {const_iterator(pr.first), const_iterator(pr.second)};
662 #else
663 return std::equal_range(cbegin(), cend(), x, gcomp());
664 #endif
665 }
666 #undef YB_Impl_Set_GenericLookupHead
667
668 private:
670 void
671 amend_all() const ynothrow
672 {
673 for(const auto& pr : m_map)
674 amend_pair(pr);
675 }
676
677 static void
678 amend_pair(const umap_pair& pr) ynothrow
679 {
680 pr.first.amend(pr.second);
681 }
682
683 #if !YB_Impl_Set_UseGenericLookup
684 mapped_key_compare
686 gcomp() const
687 {
688 return m_map.key_comp();
689 }
690 #endif
691
692 template<typename _tIter>
693 static umap_pair
694 iter_trans(const _tIter& i)
695 {
696 return {mapped_key_type(*i), *i};
697 }
698 };
699
700 #undef YB_Impl_Set_UseGenericLookup
701
702 } // namespace ystdex;
703
704 #endif
705
ystdex::mapped_set::empty
bool empty() const
Definition: set.hpp:358
ystdex::details::tcompare< _tWrappedKey, _fComp, true >::operator()
bool operator()(const _tWrappedKey &x, const _tKey &y) const
Definition: set.hpp:109
ystdex::mapped_set::mapped_set
mapped_set(const _fComp &comp, const _tAlloc &a=_tAlloc())
Definition: set.hpp:205
ystdex::mapped_set::iterator
wrap_iter< typename umap_type::iterator > iterator
Definition: set.hpp:185
ystdex::details::tcompare::tcompare
tcompare(_fComp c)
Definition: set.hpp:75
ystdex::mapped_set::end
const_iterator end() const
Definition: set.hpp:306
ystdex::mapped_set::rend
reverse_iterator rend()
Definition: set.hpp:323
ystdex::mapped_set::rbegin
const_reverse_iterator rbegin() const
Definition: set.hpp:317
ystdex::mapped_set::mapped_key_compare
details::tcompare< mapped_key_type, _fComp > mapped_key_compare
Definition: set.hpp:173
ystdex::mapped_set::mapped_set
mapped_set(_tIn first, _tIn last, const _tAlloc &a)
Definition: set.hpp:248
ystdex::mapped_set::amend_all
void amend_all() const
Definition: set.hpp:671
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:680
ystdex::mapped_set::const_iterator
wrap_iter< typename umap_type::const_iterator > const_iterator
Definition: set.hpp:186
ystdex::mapped_set::mapped_set
mapped_set(mapped_set &&s, const _tAlloc &a)
Definition: set.hpp:238
ystdex::mapped_set::value_compare
_fComp value_compare
Definition: set.hpp:166
ystdex::mapped_set::erase
size_type erase(const key_type &x)
Definition: set.hpp:476
ystdex::mapped_set::get_allocator
allocator_type get_allocator() const
Definition: set.hpp:284
ystdex::details::wrapped_key::key_type
_type key_type
Definition: set.hpp:126
iterator.hpp
通用迭代器。
ystdex::mapped_set::lower_bound
const_iterator lower_bound(const key_type &x) const
Definition: set.hpp:576
ystdex::details::tcompare< _tWrappedKey, _fComp, true >::operator()
bool operator()(const _tKey &x, const _tWrappedKey &y) const
Definition: set.hpp:115
ystdex::mapped_set::operator=
mapped_set & operator=(mapped_set &&s)
Definition: set.hpp:266
ystdex::mapped_set::begin
const_iterator begin() const
Definition: set.hpp:295
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
NPL::x
const TermNode &term ynothrow const TermNode &term ynothrow const TermNode &term ynothrow TermNode &term const TermNode &term ValueNode &node const ValueNode &node const _type & x
Definition: SContext.h:94
ystdex::mapped_set::equal_range
std::pair< iterator, iterator > equal_range(const key_type &x)
Definition: set.hpp:629
ystdex::details::wrapped_key::wrapped_key
wrapped_key(const key_type &key)
Definition: set.hpp:133
platform::bool
std::FILE *fp bool
Definition: FileIO.h:1280
yimpl
#define yimpl(...)
实现标签。
Definition: ydef.h:262
ystdex::details::wrapped_key::wrapper
lref< const key_type > wrapper
Definition: set.hpp:127
ystdex::mapped_set::erase
iterator erase(iterator position)
Definition: set.hpp:466
ystdex::mapped_set::key_type
_type key_type
Definition: set.hpp:163
ystdex::mapped_set::insert
std::pair< iterator, bool > insert(value_type &&x)
Definition: set.hpp:411
ystdex::mapped_set::const_reference
const value_type & const_reference
Definition: set.hpp:169
CHRLib::args
_tParams && args
Definition: CharacterProcessing.h:538
ystdex::mapped_set::find
iterator find(const key_type &x)
Definition: set.hpp:522
ystdex::mapped_set::crbegin
const_reverse_iterator crbegin() const
Definition: set.hpp:346
ystdex::mapped_set::max_size
size_type max_size() const
Definition: set.hpp:370
ystdex::mapped_set::emplace
std::pair< iterator, bool > emplace(_tParams &&...args)
Definition: set.hpp:377
ystdex::mapped_set::iter_trans
static umap_pair iter_trans(const _tIter &i)
Definition: set.hpp:694
ystdex::mapped_set::mapped_key_type
details::wrapped_key< _type > mapped_key_type
Definition: set.hpp:172
ystdex::lref< const key_type >
ystdex::mapped_set::count
size_type count(const key_type &x) const
Definition: set.hpp:555
ystdex::mapped_set::allocator_type
_tAlloc allocator_type
Definition: set.hpp:167
YSLib::a
YB_PURE const _type * a
Definition: YCoreUtilities.h:167
ystdex::mapped_set::erase
iterator erase(const_iterator first, const_iterator last)
Definition: set.hpp:481
ystdex::mapped_set::reference
value_type & reference
Definition: set.hpp:168
ystdex::mapped_set::key_compare
_fComp key_compare
Definition: set.hpp:165
ystdex::mapped_set::~mapped_set
~mapped_set()=default
ystdex::mapped_set::mapped_set
mapped_set(std::initializer_list< value_type > il, const _tAlloc &a)
Definition: set.hpp:251
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:766
ystdex::set_value_move
const _type & set_value_move(const _type &x)
转移集合元素。
Definition: set.hpp:49
ystdex::mapped_set::erase
iterator erase(const_iterator position)
Definition: set.hpp:471
ystdex::transformed_iterator
变换迭代器。
Definition: iterator.hpp:216
ystdex::mapped_set::amend_pair
static void amend_pair(const umap_pair &pr)
Definition: set.hpp:678
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
ystdex
特性测试宏。
Definition: ydef.h:822
ystdex::mapped_set::pointer
typename std::allocator_traits< _tAlloc >::pointer pointer
Definition: set.hpp:189
ystdex::mapped_set::mapped_set
mapped_set(mapped_set &&s)
Definition: set.hpp:221
ystdex::details::wrapped_key::amend
void amend(const _type &key) const
Definition: set.hpp:138
YSLib::i
return i
Definition: YCoreUtilities.h:176
ystdex::mapped_set::emplace_hint
iterator emplace_hint(const_iterator position, _tParams &&...args)
Definition: set.hpp:387
ystdex::mapped_set::end
iterator end()
Definition: set.hpp:301
ystdex::mapped_set::insert
iterator insert(const_iterator position, value_type &&x)
Definition: set.hpp:438
ystdex::mapped_set::insert
iterator insert(const_iterator position, const value_type &x)
Definition: set.hpp:424
ystdex::mapped_set::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: set.hpp:193
ystdex::details::wrapped_key
Definition: set.hpp:123
ystdex::mapped_set::clear
void clear()
Definition: set.hpp:498
ystdex::mapped_set::m_map
umap_type m_map
Definition: set.hpp:198
ystdex::mapped_set::operator=
mapped_set & operator=(std::initializer_list< value_type > il)
Definition: set.hpp:277
ystdex::mapped_set::value_comp
value_compare value_comp() const
Definition: set.hpp:510
ystdex::details::wrapped_key::k
wrapper k
Definition: set.hpp:130
ystdex::mapped_set::mapped_set
mapped_set(const mapped_set &s, const _tAlloc &a)
Definition: set.hpp:233
ystdex::is_nothrow_swappable
Definition: type_traits.hpp:555
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:334
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::insert
void insert(_tIn first, _tIn last)
Definition: set.hpp:452
ystdex::mapped_set::mapped_set
mapped_set()
Definition: set.hpp:201
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::insert
void insert(std::initializer_list< value_type > il)
Definition: set.hpp:460
std
Definition: memory.hpp:1183
ystdex::mapped_set::lower_bound
iterator lower_bound(const key_type &x)
Definition: set.hpp:571
ystdex::mapped_set::begin
iterator begin()
Definition: set.hpp:290
ystdex::details::tcompare::comp
_fComp comp
Definition: set.hpp:73
ystdex::mapped_set::equal_range
std::pair< const_iterator, const_iterator > equal_range(const key_type &x) const
Definition: set.hpp:636
ystdex::mapped_set
允许指定不同于值类型的键的集合。
Definition: set.hpp:160
functor.hpp
通用仿函数。
ystdex::details::tcompare::operator()
bool operator()(const _tWrappedKey &x, const _tWrappedKey &y) const
Definition: set.hpp:80
ystdex::mapped_set::find
const_iterator find(const key_type &x) const
Definition: set.hpp:527
ystdex::mapped_set::size_type
typename umap_type::size_type size_type
Definition: set.hpp:187
ystdex::mapped_set::upper_bound
iterator upper_bound(const key_type &x)
Definition: set.hpp:600
CHRLib::c
c
Definition: CharacterProcessing.h:81
ystdex::mapped_set::mapped_set
mapped_set(const _tAlloc &a)
Definition: set.hpp:230
ystdex::mapped_set::insert
std::pair< iterator, bool > insert(const value_type &x)
Definition: set.hpp:395
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:995
ystdex::mapped_set::rend
const_reverse_iterator rend() const
Definition: set.hpp:328
ystdex::mapped_set::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition: set.hpp:192
ystdex::mapped_set::rbegin
reverse_iterator rbegin()
Definition: set.hpp:312
ystdex::mapped_set::crend
const_reverse_iterator crend() const
Definition: set.hpp:352
ystdex::mapped_set::const_pointer
typename std::allocator_traits< _tAlloc >::const_pointer const_pointer
Definition: set.hpp:191
ystdex::transformed_iterator::get
iterator_type & get()
取原迭代器引用。
Definition: iterator.hpp:431
ystdex::mapped_set::cend
const_iterator cend() const
Definition: set.hpp:340
YB_Impl_Set_GenericLookupHead
#define YB_Impl_Set_GenericLookupHead(_n, _r)
Definition: set.hpp:515
ystdex::mapped_set::key_comp
key_compare key_comp() const
Definition: set.hpp:504
ystdex::mapped_set::mapped_set
mapped_set(const mapped_set &s)
Definition: set.hpp:216
ystdex::mapped_set::size
size_type size() const
Definition: set.hpp:364
ystdex::mapped_set::mapped_set
mapped_set(std::initializer_list< value_type > il, const _fComp &comp=_fComp(), const _tAlloc &a=_tAlloc())
Definition: set.hpp:243
ystdex::mapped_set::swap
void swap(mapped_set &s)
Definition: set.hpp:487
ystdex::mapped_set::upper_bound
const_iterator upper_bound(const key_type &x) const
Definition: set.hpp:605
ystdex::mapped_set::gcomp
mapped_key_compare gcomp() const
Definition: set.hpp:686
ynoexcept
#define ynoexcept(...)
YSLib 无异常抛出保证：指定特定的异常规范。
Definition: ydef.h:746
ystdex::mapped_set::umap_pair
typename umap_type::value_type umap_pair
Definition: set.hpp:176
ystdex::mapped_set::value_type
_type value_type
Definition: set.hpp:164
ystdex::details::tcompare
Definition: set.hpp:71
ystdex::mapped_set::difference_type
typename umap_type::difference_type difference_type
Definition: set.hpp:188