YSTest: any.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
any.h
浏览该文件的文档.
1 /*
2 © 2011-2014 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_any_h_
29 #define YB_INC_ystdex_any_h_ 1
30
31 #include "utility.hpp"
32 #include <memory> // for std::addressof, std::unique_ptr;
33 #include <typeinfo> // for typeid, std::bad_cast;
34
35 namespace ystdex
36 {
37
38 /*
39 \brief 用于表示任意不需要复制存储的非聚集 POD 类型。
40 \note POD 和聚集类型的含义参考 ISO C++11 。
41 \since build 352
42 \todo 确定整数和枚举类型的必要性。
43 */
44 union non_aggregate_pod
45 {
46 void* object_ptr;
47 const void* const_object_ptr;
48 volatile void* volatile_object_ptr;
49 const volatile void* const_volatile_object_ptr;
50 void(*function_ptr)();
51 int(non_aggregate_pod::*member_object_pointer);
52 void(non_aggregate_pod::*member_function_pointer)();
53 };
54
55
56 /*
57 \brief 任意 POD 类型存储。
58 \note POD 的含义参考 ISO C++11 。
59 \since build 351
60 */
61 template<typename _tPOD = aligned_storage_t<sizeof(void*)>>
62 union pod_storage
63 {
64 static_assert(is_pod<_tPOD>::value, "Non-POD underlying type found.");
65
66 using underlying = _tPOD;
67
68 underlying object;
69 byte data[sizeof(underlying)];
70
72
73 pod_storage() = default;
75 template<typename _type,
76 yimpl(typename = ystdex::exclude_self_ctor_t<pod_storage, _type>)>
77 pod_storage(_type&& x)
78 {
79 new(access()) remove_reference_t<_type>(yforward(x));
80 }
81
82 /*
83 \note 为避免类型错误，需要确定类型时应使用显式使用 access 指定类型赋值。
84 \since build 454
85 */
86 template<typename _type,
87 yimpl(typename = ystdex::exclude_self_ctor_t<pod_storage, _type>)>
88 pod_storage&
89 operator=(_type&& x)
90 {
91 access<remove_reference_t<_type>>() = yforward(x);
92 return *this;
93 }
95
96 YB_PURE void*
97 access()
98 {
99 return &data[0];
100 }
101 yconstfn YB_PURE const void*
102 access() const
103 {
104 return &data[0];
105 }
106 template<typename _type>
107 YB_PURE _type&
108 access()
109 {
110 return *static_cast<_type*>(access());
111 }
112 template<typename _type>
113 yconstfn YB_PURE const _type&
114 access() const
115 {
116 return *static_cast<const _type*>(access());
117 }
118 };
119
120
127 class void_ref
128 {
129 private:
130 const volatile void* ptr;
131
132 public:
133 template<typename _type>
134 yconstfn
135 void_ref(_type& obj)
136 : ptr(&obj)
137 {}
138
139 template<typename _type>
140 yconstfn YB_PURE
141 operator _type&() const
142 {
143 return *static_cast<_type*>(&*this);
144 }
145
146 YB_PURE void*
147 operator&() const volatile
148 {
149 return const_cast<void*>(ptr);
150 }
151 };
152
153
155 namespace any_ops
156 {
157
162 class YB_API holder : public cloneable
163 {
164 public:
165 virtual
166 ~holder()
167 {}
168
170 virtual void*
171 get() const = 0;
172
173 virtual holder*
174 clone() const override = 0;
175
177 virtual const std::type_info&
178 type() const ynothrow = 0;
179 };
180
181
187 template<typename _type>
188 class value_holder : public holder
189 {
190 static_assert(is_object<_type>::value, "Non-object type found.");
191 static_assert(!(is_const<_type>::value || is_volatile<_type>::value),
192 "Cv-qualified type found.");
193
194 public:
196 using value_type = _type;
197
198 protected:
200 mutable _type held;
201
202 public:
203 value_holder(const _type& value)
204 : held(value)
205 {}
211 value_holder(_type&& value) ynoexcept(ynoexcept(_type(std::move(value))))
212 : held(std::move(value))
213 {}
214
215 value_holder*
216 clone() const override
217 {
218 return new value_holder(held);
219 }
220
222 void*
223 get() const override
224 {
225 return std::addressof(held);
226 }
227
229 const std::type_info&
230 type() const ynothrow override
231 {
232 return typeid(_type);
233 }
234 };
235
236
243 template<typename _type>
244 class pointer_holder : public holder
245 {
246 static_assert(is_object<_type>::value, "Invalid type found.");
247
248 public:
250 using value_type = _type;
251
252 protected:
254 _type* p_held;
255
256 public:
257 pointer_holder(_type* value)
258 : p_held(value)
259 {}
261
262 pointer_holder(const pointer_holder& h)
263 : pointer_holder(h.p_held ? new _type(*h.p_held) : nullptr)
264 {}
265 pointer_holder(pointer_holder&& h)
266 : p_held(h.p_held)
267 {
268 h.p_held = {};
269 }
271 virtual
273 ~pointer_holder()
274 {
275 delete p_held;
276 }
277
278 pointer_holder*
279 clone() const override
280 {
281 return new pointer_holder(*this);
282 }
283
285 void*
286 get() const override
287 {
288 return p_held;
289 }
290
292 const std::type_info&
293 type() const ynothrow override
294 {
295 return p_held ? typeid(_type) : typeid(void);
296 }
297 };
298
299
301 using op_code = std::uint32_t;
302
304 enum base_op : op_code
305 {
307 no_op,
308 get_type,
309 get_ptr,
310 clone,
311 destroy,
312 get_holder_type,
313 get_holder_ptr,
315 end_base_op
316 };
317
318
320
321 using any_storage = pod_storage<non_aggregate_pod>;
322 using any_manager = void(*)(any_storage&, const any_storage&, op_code);
323
324
326 struct holder_tag
327 {};
329
330
335 template<typename _type, bool _bStoredLocally = sizeof(_type)
336 <= sizeof(any_storage) && yalignof(_type) <= yalignof(any_storage)
337 && yalignof(any_storage) % yalignof(_type) == 0>
338 class value_handler
339 {
340 public:
342
343 using value_type = _type;
344 using local_storage = integral_constant<bool, _bStoredLocally>;
345
346 static value_type*
347 get_pointer(const any_storage& s)
348 {
349 return const_cast<value_type*>(_bStoredLocally ? std::addressof(
350 s.access<value_type>()) : s.access<const value_type*>());
351 }
353
355 static value_type&
356 get_reference(const any_storage& s)
357 {
358 yassume(get_pointer(s));
359 return *get_pointer(s);
360 }
361
363 static void
364 copy(any_storage& d, const any_storage& s, true_type)
365 {
366 new(d.access()) value_type(s.access<value_type>());
367 }
369 static void
370 copy(any_storage& d, const any_storage& s, false_type)
371 {
372 d = new value_type(*s.access<value_type*>());
373 }
374
376
377 static void
378 uninit(any_storage& d, true_type)
379 {
380 d.access<value_type>().~value_type();
381 }
382 static void
383 uninit(any_storage& d, false_type)
384 {
385 delete d.access<value_type*>();
386 }
387
388 template<typename _tValue>
389 static void
390 init(any_storage& d, _tValue&& x)
391 {
392 init_impl(d, yforward(x), local_storage());
393 }
395
396 private:
398
399 template<typename _tValue>
400 static void
401 init_impl(any_storage& d, _tValue&& x, true_type)
402 {
403 new(d.access()) value_type(yforward(x));
404 }
405 template<typename _tValue>
406 static void
407 init_impl(any_storage& d, _tValue&& x, false_type)
408 {
409 d = new value_type(yforward(x));
410 }
412
413 public:
415 static void
416 manage(any_storage& d, const any_storage& s, op_code op)
417 {
418 switch(op)
419 {
420 case get_type:
421 d = &typeid(value_type);
422 break;
423 case get_ptr:
424 d = get_pointer(s);
425 break;
426 case clone:
427 copy(d, s, local_storage());
428 break;
429 case destroy:
430 uninit(d, local_storage());
431 break;
432 case get_holder_type:
433 d = &typeid(void);
434 break;
435 case get_holder_ptr:
436 d = static_cast<holder*>(nullptr);
437 }
438 }
439 };
440
441
446 template<typename _type>
447 class ref_handler : public value_handler<_type*>
448 {
449 public:
450 using value_type = _type;
451 using base = value_handler<value_type*>;
452
454 static value_type*
455 get_pointer(const any_storage& s)
456 {
457 return base::get_reference(s);
458 }
459
461 static value_type&
462 get_reference(const any_storage& s)
463 {
464 yassume(get_pointer(s));
465 return *get_pointer(s);
466 }
467
468 static void
469 init(any_storage& d, std::reference_wrapper<value_type> x)
470 {
471 base::init(d, std::addressof(x.get()));
472 }
473
474 static void
475 manage(any_storage& d, const any_storage& s, op_code op)
476 {
477 switch(op)
478 {
479 case get_type:
480 d = &typeid(value_type);
481 break;
482 case get_ptr:
483 d = get_pointer(s);
484 break;
485 default:
486 base::manage(d, s, op);
487 }
488 }
489 };
490
491
496 template<typename _tHolder>
497 class holder_handler : public value_handler<_tHolder>
498 {
499 static_assert(is_convertible<_tHolder&, holder&>::value,
500 "Invalid holder type found.");
501
502 public:
503 using value_type = typename _tHolder::value_type;
504 using base = value_handler<_tHolder>;
505 using local_storage = typename base::local_storage;
506
507 static value_type*
508 get_pointer(const any_storage& s)
509 {
510 return static_cast<value_type*>(base::get_pointer(s)->_tHolder::get());
511 }
512
513 private:
515 static void
516 init(any_storage& d, std::unique_ptr<_tHolder> p, true_type)
517 {
518 new(d.access()) _tHolder(std::move(*p));
519 }
521 static void
522 init(any_storage& d, std::unique_ptr<_tHolder> p, false_type)
523 {
524 d = p.release();
525 }
526
527 public:
529 static void
530 init(any_storage& d, std::unique_ptr<_tHolder> p)
531 {
532 init(d, std::move(p), local_storage());
533 }
534 static void
535 init(any_storage& d, _tHolder&& x)
536 {
537 base::init(d, std::move(x));
538 }
539 template<typename... _tParams>
540 static void
541 init(any_storage& d, _tParams&&... args)
542 {
543 init(d, _tHolder(yforward(args)...));
544 }
545
546 static void
547 manage(any_storage& d, const any_storage& s, op_code op)
548 {
549 switch(op)
550 {
551 case get_type:
552 d = &typeid(value_type);
553 break;
554 case get_ptr:
555 d = get_pointer(s);
556 break;
557 case clone:
558 base::copy(d, s, local_storage());
559 break;
560 case destroy:
561 base::uninit(d, local_storage());
562 break;
563 case get_holder_type:
564 d = &typeid(_tHolder);
565 break;
566 case get_holder_ptr:
567 d = static_cast<holder*>(base::get_pointer(s));
568 }
569 }
570 };
571
572 } // namespace any_ops;
573
574
584 class YB_API any
585 {
586 protected:
588
589 any_ops::any_storage storage;
590 any_ops::any_manager manager;
592
593 public:
595 yconstfn
596 any() ynothrow
597 : storage(), manager()
598 {}
600 template<typename _type, yimpl(typename = exclude_self_ctor_t<any, _type>)>
601 any(_type&& x)
602 : manager(any_ops::value_handler<remove_reference_t<_type>>::manage)
603 {
604 any_ops::value_handler<typename remove_rcv<_type>::type>::init(storage,
605 yforward(x));
606 }
608
609 template<typename _type>
610 any(std::reference_wrapper<_type> x)
611 : manager(any_ops::ref_handler<_type>::manage)
612 {
613 any_ops::ref_handler<_type>::init(storage, x);
614 }
619 template<typename _tHolder>
620 any(any_ops::holder_tag, std::unique_ptr<_tHolder> p)
621 : manager(any_ops::holder_handler<_tHolder>::manage)
622 {
623 any_ops::holder_handler<_tHolder>::init(storage, std::move(p));
624 }
625 template<typename _type>
626 any(_type&& x, any_ops::holder_tag)
627 : manager(any_ops::holder_handler<any_ops::value_holder<typename
628 remove_rcv<_type>::type>>::manage)
629 {
630 any_ops::holder_handler<any_ops::value_holder<
631 remove_cv_t<_type>>>::init(storage, yforward(x));
632 }
634 any(const any&);
635 any(any&& a) ynothrow
636 : any()
637 {
638 a.swap(*this);
639 }
641 ~any();
642
643 template<typename _type>
644 any&
645 operator=(const _type& x)
646 {
647 any(x).swap(*this);
648 return *this;
649 }
654 any&
655 operator=(const any& a)
656 {
657 any(a).swap(*this);
658 return *this;
659 }
664 any&
665 operator=(any&& a) ynothrow
666 {
667 any(std::move(a)).swap(*this);
668 return *this;
669 }
670
671 bool
672 operator!() const ynothrow
673 {
674 return empty();
675 }
676
677 explicit
678 operator bool() const ynothrow
679 {
680 return !empty();
681 }
682
683 bool
684 empty() const ynothrow
685 {
686 return !manager;
687 }
688
690 void*
691 get() const ynothrow;
692
693 any_ops::holder*
694 get_holder() const;
695
696 void
697 clear() ynothrow;
698
699 void
700 swap(any& a) ynothrow;
701
703
704 template<typename _type>
705 _type*
706 target() ynothrow
707 {
708 return type() == typeid(_type) ? static_cast<_type*>(get()) : nullptr;
709 }
710 template<typename _type>
711 const _type*
712 target() const ynothrow
713 {
714 return type() == typeid(_type)
715 ? static_cast<const _type*>(get()) : nullptr;
716 }
718
720 const std::type_info&
721 type() const ynothrow;
722 };
723
728 inline void
729 swap(any& x, any& y) ynothrow
730 {
731 x.swap(y);
732 }
733
734
741 class bad_any_cast : public std::bad_cast
742 {
743 private:
745 const char* from_name;
747 const char* to_name;
748
749 public:
751
752 bad_any_cast()
753 : std::bad_cast(),
754 from_name("unknown"), to_name("unknown")
755 {};
756 bad_any_cast(const std::type_info& from_type, const std::type_info& to_type)
757 : std::bad_cast(),
758 from_name(from_type.name()), to_name(to_type.name())
759 {}
760
761 const char*
762 from() const ynothrow
763 {
764 return from_name;
765 }
766
767 const char*
768 to() const ynothrow
769 {
770 return to_name;
771 }
773
774 virtual const char*
775 what() const ynothrow override
776 {
777 return "Failed conversion: any_cast.";
778 }
779 };
780
781
792
793 template<typename _tPointer>
794 inline _tPointer
795 any_cast(any* p) ynothrow
796 {
797 return p ? p->target<remove_pointer_t<_tPointer>>() : nullptr;
798 }
799 template<typename _tPointer>
800 inline _tPointer
801 any_cast(const any* p) ynothrow
802 {
803 return p ? p->target<remove_pointer_t<_tPointer>>() : nullptr;
804 }
806
811 template<typename _tValue>
812 inline _tValue
813 any_cast(any& x)
814 {
815 const auto tmp(any_cast<remove_reference_t<_tValue>*>(&x));
816
817 if(!tmp)
818 throw bad_any_cast(x.type(), typeid(_tValue));
819 return static_cast<_tValue>(*tmp);
820 }
821 template<typename _tValue>
822 _tValue
823 any_cast(const any& x)
824 {
825 const auto tmp(any_cast<remove_reference_t<_tValue>*>(&x));
826
827 if(!tmp)
828 throw bad_any_cast(x.type(), typeid(_tValue));
829 return static_cast<_tValue>(*tmp);
830 }
832
833
842 template<typename _type>
843 inline _type*
844 unsafe_any_cast(any* p)
845 {
846 yconstraint(p);
847 return static_cast<_type*>(p->get());
848 }
849
850 template<typename _type>
851 inline const _type*
852 unsafe_any_cast(const any* p)
853 {
854 yconstraint(p);
855 return static_cast<const _type*>(p->get());
856 }
858
859
865 struct pseudo_output
866 {
867 template<typename... _tParams>
868 inline pseudo_output&
869 operator=(_tParams&&...)
870 {
871 return *this;
872 }
873 };
874
875 } // namespace ystdex;
876
877 #endif
878
utility.hpp
实用设施。
ystdex::any
基于类型擦除的动态泛型对象。
Definition: any.h:584
ystdex::pod_storage::underlying
_tPOD underlying
Definition: any.h:66
ystdex::bad_any_cast
动态泛型转换失败异常。
Definition: any.h:741
ystdex::any_ops::pointer_holder::pointer_holder
pointer_holder(pointer_holder &&h)
Definition: any.h:265
ystdex::bad_any_cast::to
const char * to() const
Definition: any.h:768
ystdex::any_ops::any_storage
pod_storage< non_aggregate_pod > any_storage
Definition: any.h:321
ystdex::non_aggregate_pod::const_object_ptr
const void * const_object_ptr
Definition: any.h:47
ystdex::pod_storage::operator=
pod_storage & operator=(_type &&x)
Definition: any.h:89
ystdex::void_ref
任意对象引用类型。
Definition: any.h:127
ystdex::any_ops::value_holder::value_holder
value_holder(const _type &value)
Definition: any.h:203
ystdex::remove_reference_t
typename remove_reference< _type >::type remove_reference_t
Definition: type_op.hpp:234
ystdex::any_ops::value_holder
值类型动态泛型持有者。
Definition: any.h:188
YSLib::UI::args
yconstfn const string _tParams && args
Definition: Loader.h:111
ystdex::bad_any_cast::what
virtual const char * what() const override
Definition: any.h:775
ystdex::pod_storage::object
underlying object
Definition: any.h:68
ystdex::any::any
any(std::reference_wrapper< _type > x)
Definition: any.h:610
ystdex::bad_any_cast::bad_any_cast
bad_any_cast(const std::type_info &from_type, const std::type_info &to_type)
Definition: any.h:756
ystdex::pod_storage
Definition: any.h:62
ystdex::pod_storage::access
void * access()
Definition: any.h:97
ystdex::byte
unsigned char byte
字节类型。
Definition: ydef.h:555
ystdex::nullptr
const class ystdex::nullptr_t nullptr
ystdex::any_ops::get_holder_ptr
Definition: any.h:313
ystdex::non_aggregate_pod::const_volatile_object_ptr
const volatile void * const_volatile_object_ptr
Definition: any.h:49
ystdex::any_ops::pointer_holder::~pointer_holder
virtual ~pointer_holder()
Definition: any.h:273
ystdex::pod_storage::pod_storage
pod_storage(_type &&x)
Definition: any.h:77
ystdex::cloneable
可动态复制的抽象基类。
Definition: utility.hpp:142
ystdex::any_ops::base_op
base_op
Definition: any.h:304
ystdex::any_ops::holder
抽象动态泛型持有者接口。
Definition: any.h:162
ystdex::any_ops::pointer_holder
指针类型动态泛型持有者。
Definition: any.h:244
ystdex::non_aggregate_pod::member_object_pointer
intnon_aggregate_pod::* member_object_pointer
Definition: any.h:51
ystdex::non_aggregate_pod::function_ptr
void(* function_ptr)()
Definition: any.h:50
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:722
ystdex::any::any_cast
_tPointer any_cast(any *p)
动态泛型转换。
Definition: any.h:795
ystdex::remove_pointer_t
typename remove_pointer< _type >::type remove_pointer_t
Definition: type_op.hpp:255
ystdex::any_ops::pointer_holder::p_held
_type * p_held
Definition: any.h:254
yimpl
#define yimpl(...)
实现标签。
Definition: ydef.h:177
ystdex::any::any
any(any &&a)
Definition: any.h:635
ystdex::bad_any_cast::to_name
const char * to_name
Definition: any.h:747
ystdex::pod_storage::access
_type & access()
Definition: any.h:108
ystdex::swap
void swap(any &x, any &y)
交换对象。
Definition: any.h:729
ystdex::void_ref::void_ref
void_ref(_type &obj)
Definition: any.h:135
ystdex::any_ops::value_holder::value_holder
value_holder(_type &&value)
转移构造。
Definition: any.h:211
ystdex::any_ops::pointer_holder::clone
pointer_holder * clone() const override
Definition: any.h:279
ystdex::any_ops::get_holder_type
Definition: any.h:312
ystdex::any::target
const _type * target() const
Definition: any.h:712
ystdex::any_ops::value_holder::value_type
_type value_type
Definition: any.h:196
ystdex::any_ops::value_holder::clone
value_holder * clone() const override
Definition: any.h:216
ystdex::void_ref::operator&
void * operator&() const volatile
Definition: any.h:147
yassume
#define yassume
假定：环境语义。
Definition: cassert.h:58
ystdex::any_ops::value_holder::held
_type held
Definition: any.h:200
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
ystdex::any::unsafe_any_cast
_type * unsafe_any_cast(any *p)
非安全动态泛型转换。
Definition: any.h:844
ystdex::any::type
const std::type_info & type() const
Definition: any.cpp:92
YSLib::UI::name
yconstfn const string & name
Definition: Loader.h:110
ystdex::any::operator=
any & operator=(any &&a)
转移赋值：使用复制和交换。
Definition: any.h:665
yalignof
#define yalignof(_type)
指定特定类型的对齐。
Definition: ydef.h:442
ystdex::any::storage
any_ops::any_storage storage
Definition: any.h:589
ystdex::remove_cv_t
typename remove_cv< _type >::type remove_cv_t
Definition: type_op.hpp:222
ystdex::any::any
any(any_ops::holder_tag, std::unique_ptr< _tHolder > p)
构造：使用指定持有者。
Definition: any.h:620
YB_API
#define YB_API
YBase 应用程序编程接口：用于向库文件约定链接。
Definition: ydef.h:391
yconstraint
#define yconstraint
约束：接口语义。
Definition: cassert.h:47
ystdex::any::get
void * get() const
Definition: any.cpp:49
ystdex::any_ops::value_holder::type
const std::type_info & type() const override
Definition: any.h:230
ystdex::bad_any_cast::bad_any_cast
bad_any_cast()
Definition: any.h:752
ystdex::non_aggregate_pod::volatile_object_ptr
volatile void * volatile_object_ptr
Definition: any.h:48
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:331
ystdex::any::any_cast
_tValue any_cast(any &x)
Definition: any.h:813
ystdex::pod_storage::access
const void * access() const
Definition: any.h:102
ystdex::any_ops::get_type
Definition: any.h:308
ystdex::any::swap
void swap(any &a)
Definition: any.cpp:85
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:463
ystdex::exclude_self_ctor_t
enable_if_t<!is_same< _tClass &, remove_rcv_t< _tParam > & >::value, _type > exclude_self_ctor_t
移除选择类类型的特定重载避免构造模板和复制/转移构造函数冲突。
Definition: type_op.hpp:766
ystdex::any_ops::no_op
Definition: any.h:307
ystdex::pod_storage::data
byte data[sizeof(underlying)]
Definition: any.h:69
ystdex::any::operator!
bool operator!() const
Definition: any.h:672
ystdex::any_ops::op_code
std::uint32_t op_code
Definition: any.h:301
platform_ex::Windows::s
return s
Definition: MinGW32.cpp:49
ystdex::any_ops::pointer_holder::type
const std::type_info & type() const override
Definition: any.h:293
ystdex::any_ops::pointer_holder::value_type
_type value_type
Definition: any.h:250
ystdex::bad_any_cast::from_name
const char * from_name
Definition: any.h:745
ystdex::any::operator=
any & operator=(const _type &x)
Definition: any.h:645
ystdex::any::operator=
any & operator=(const any &a)
复制赋值：使用复制和交换。
Definition: any.h:655
ystdex::pseudo_output::operator=
pseudo_output & operator=(_tParams &&...)
Definition: any.h:869
ystdex::any_ops::get_ptr
Definition: any.h:309
ystdex::non_aggregate_pod
Definition: any.h:44
ystdex::any::empty
bool empty() const
Definition: any.h:684
ystdex::any::any
any(_type &&x, any_ops::holder_tag)
Definition: any.h:626
ystdex::pod_storage::pod_storage
pod_storage()=default
ystdex::any::manager
any_ops::any_manager manager
Definition: any.h:590
ystdex::non_aggregate_pod::member_function_pointer
void(non_aggregate_pod::* member_function_pointer)()
Definition: any.h:52
ystdex::any_ops::clone
Definition: any.h:310
ynoexcept
#define ynoexcept(...)
YSLib 无异常抛出保证：指定特定的异常规范。
Definition: ydef.h:526
ystdex::any_ops::destroy
Definition: any.h:311
ystdex::pod_storage::access
const _type & access() const
Definition: any.h:114
ystdex::any_ops::pointer_holder::pointer_holder
pointer_holder(const pointer_holder &h)
Definition: any.h:262
ystdex::any_ops::end_base_op
Definition: any.h:315
ystdex::any_ops::pointer_holder::pointer_holder
pointer_holder(_type *value)
Definition: any.h:257
ystdex::any_ops::holder_tag
使用持有者标记。
Definition: any.h:326
ystdex::any_ops::any_manager
void(*)(any_storage &, const any_storage &, op_code) any_manager
Definition: any.h:322
ystdex::any::any
any()
Definition: any.h:596
ystdex::any::any
any(_type &&x)
Definition: any.h:601
ystdex::remove_rcv
移除可能被 cv-qualifier 修饰的引用类型。
Definition: type_op.hpp:657
ystdex::void_ref::ptr
const volatile void * ptr
Definition: any.h:130
ystdex::pseudo_output
伪输出对象。
Definition: any.h:865
ystdex::any_ops::holder::~holder
virtual ~holder()
Definition: any.h:166
ystdex::non_aggregate_pod::object_ptr
void * object_ptr
Definition: any.h:46
ystdex::bad_any_cast::from
const char * from() const
Definition: any.h:762