34
34
# pragma once
35
35
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
36
36
37
+ #include " detail/config.hpp"
37
38
#include " type_traits.hpp" // enable_if_t, is_*
38
39
#include " utility.hpp" // in_place_type_t, move, forward
39
40
@@ -331,7 +332,8 @@ namespace bpstd {
331
332
// definitions : class : bad_any_cast
332
333
// =============================================================================
333
334
334
- inline const char * bpstd::bad_any_cast::what ()
335
+ inline
336
+ const char * bpstd::bad_any_cast::what ()
335
337
const noexcept
336
338
{
337
339
return " bad_any_cast" ;
@@ -363,30 +365,34 @@ struct bpstd::any::internal_storage_handler
363
365
364
366
template <typename T>
365
367
template <typename ...Args>
366
- inline T* bpstd::any::internal_storage_handler<T>
368
+ inline BPSTD_INLINE_VISIBILITY
369
+ T* bpstd::any::internal_storage_handler<T>
367
370
::construct (storage& s, Args&&...args)
368
371
{
369
372
return ::new (&s.internal ) T (bpstd::forward<Args>(args)...);
370
373
}
371
374
372
375
template <typename T>
373
376
template <typename U, typename ...Args>
374
- inline T* bpstd::any::internal_storage_handler<T>
377
+ inline BPSTD_INLINE_VISIBILITY
378
+ T* bpstd::any::internal_storage_handler<T>
375
379
::construct (storage& s, std::initializer_list<U> il, Args&&...args)
376
380
{
377
381
return ::new (&s.internal ) T (il, bpstd::forward<Args>(args)...);
378
382
}
379
383
380
384
template <typename T>
381
- inline void bpstd::any::internal_storage_handler<T>
385
+ inline BPSTD_INLINE_VISIBILITY
386
+ void bpstd::any::internal_storage_handler<T>
382
387
::destroy (storage& s)
383
388
{
384
389
auto * t = static_cast <T*>(static_cast <void *>(&s.internal ));
385
390
t->~T ();
386
391
}
387
392
388
393
template <typename T>
389
- inline const void * bpstd::any::internal_storage_handler<T>
394
+ inline BPSTD_INLINE_VISIBILITY
395
+ const void * bpstd::any::internal_storage_handler<T>
390
396
::handle (operation op,
391
397
const storage* self,
392
398
const storage* other)
@@ -476,7 +482,8 @@ struct bpstd::any::external_storage_handler
476
482
477
483
template <typename T>
478
484
template <typename ...Args>
479
- inline T* bpstd::any::external_storage_handler<T>
485
+ inline BPSTD_INLINE_VISIBILITY
486
+ T* bpstd::any::external_storage_handler<T>
480
487
::construct (storage& s, Args&&...args)
481
488
{
482
489
s.external = new T (bpstd::forward<Args>(args)...);
@@ -485,22 +492,25 @@ inline T* bpstd::any::external_storage_handler<T>
485
492
486
493
template <typename T>
487
494
template <typename U, typename ...Args>
488
- inline T* bpstd::any::external_storage_handler<T>
495
+ inline BPSTD_INLINE_VISIBILITY
496
+ T* bpstd::any::external_storage_handler<T>
489
497
::construct (storage& s, std::initializer_list<U> il, Args&&...args)
490
498
{
491
499
s.external = new T (il, bpstd::forward<Args>(args)...);
492
500
return static_cast <T*>(s.external );
493
501
}
494
502
495
503
template <typename T>
496
- inline void bpstd::any::external_storage_handler<T>
504
+ inline BPSTD_INLINE_VISIBILITY
505
+ void bpstd::any::external_storage_handler<T>
497
506
::destroy (storage& s)
498
507
{
499
508
delete static_cast <T*>(s.external );
500
509
}
501
510
502
511
template <typename T>
503
- inline const void * bpstd::any::external_storage_handler<T>
512
+ inline BPSTD_INLINE_VISIBILITY
513
+ const void * bpstd::any::external_storage_handler<T>
504
514
::handle ( operation op,
505
515
const storage* self,
506
516
const storage* other )
@@ -567,15 +577,17 @@ inline const void* bpstd::any::external_storage_handler<T>
567
577
// Constructors / Destructor / Assignment
568
578
// -----------------------------------------------------------------------------
569
579
570
- inline bpstd::any::any ()
580
+ inline BPSTD_INLINE_VISIBILITY
581
+ bpstd::any::any ()
571
582
noexcept
572
583
: m_storage{},
573
584
m_storage_handler{nullptr }
574
585
{
575
586
576
587
}
577
588
578
- inline bpstd::any::any (any&& other)
589
+ inline BPSTD_INLINE_VISIBILITY
590
+ bpstd::any::any (any&& other)
579
591
noexcept
580
592
: m_storage{},
581
593
m_storage_handler{other.m_storage_handler }
@@ -585,7 +597,8 @@ inline bpstd::any::any(any&& other)
585
597
}
586
598
}
587
599
588
- inline bpstd::any::any (const any& other)
600
+ inline BPSTD_INLINE_VISIBILITY
601
+ bpstd::any::any (const any& other)
589
602
: m_storage{},
590
603
m_storage_handler{nullptr }
591
604
{
@@ -600,7 +613,8 @@ inline bpstd::any::any(const any& other)
600
613
}
601
614
602
615
template <typename ValueType, typename >
603
- inline bpstd::any::any (ValueType&& value)
616
+ inline BPSTD_INLINE_VISIBILITY
617
+ bpstd::any::any (ValueType&& value)
604
618
: m_storage{},
605
619
m_storage_handler{nullptr }
606
620
{
@@ -612,7 +626,8 @@ inline bpstd::any::any(ValueType&& value)
612
626
}
613
627
614
628
template <typename ValueType, typename ...Args, typename >
615
- inline bpstd::any::any (in_place_type_t <ValueType>, Args&&...args)
629
+ inline BPSTD_INLINE_VISIBILITY
630
+ bpstd::any::any (in_place_type_t <ValueType>, Args&&...args)
616
631
: m_storage{},
617
632
m_storage_handler{nullptr }
618
633
{
@@ -624,7 +639,8 @@ inline bpstd::any::any(in_place_type_t<ValueType>, Args&&...args)
624
639
}
625
640
626
641
template <typename ValueType, typename U, typename ...Args, typename >
627
- inline bpstd::any::any (in_place_type_t <ValueType>,
642
+ inline BPSTD_INLINE_VISIBILITY
643
+ bpstd::any::any (in_place_type_t <ValueType>,
628
644
std::initializer_list<U> il,
629
645
Args&&...args)
630
646
: m_storage{},
@@ -639,14 +655,16 @@ inline bpstd::any::any(in_place_type_t<ValueType>,
639
655
640
656
// -----------------------------------------------------------------------------
641
657
642
- inline bpstd::any::~any ()
658
+ inline BPSTD_INLINE_VISIBILITY
659
+ bpstd::any::~any ()
643
660
{
644
661
reset ();
645
662
}
646
663
647
664
// -----------------------------------------------------------------------------
648
665
649
- inline bpstd::any& bpstd::any::operator =(any&& other)
666
+ inline BPSTD_INLINE_VISIBILITY
667
+ bpstd::any& bpstd::any::operator =(any&& other)
650
668
noexcept
651
669
{
652
670
reset ();
@@ -659,7 +677,8 @@ inline bpstd::any& bpstd::any::operator=(any&& other)
659
677
return (*this );
660
678
}
661
679
662
- inline bpstd::any& bpstd::any::operator =(const any& other)
680
+ inline BPSTD_INLINE_VISIBILITY
681
+ bpstd::any& bpstd::any::operator =(const any& other)
663
682
{
664
683
reset ();
665
684
@@ -675,7 +694,8 @@ inline bpstd::any& bpstd::any::operator=(const any& other)
675
694
}
676
695
677
696
template <typename ValueType, typename >
678
- inline bpstd::any& bpstd::any::operator =(ValueType&& value)
697
+ inline BPSTD_INLINE_VISIBILITY
698
+ bpstd::any& bpstd::any::operator =(ValueType&& value)
679
699
{
680
700
using handler_type = storage_handler<decay_t <ValueType>>;
681
701
@@ -692,7 +712,8 @@ inline bpstd::any& bpstd::any::operator=(ValueType&& value)
692
712
// -----------------------------------------------------------------------------
693
713
694
714
template <typename ValueType, typename ...Args, typename >
695
- inline bpstd::decay_t <ValueType>&
715
+ inline BPSTD_INLINE_VISIBILITY
716
+ bpstd::decay_t <ValueType>&
696
717
bpstd::any::emplace (Args&&...args)
697
718
{
698
719
using handler_type = storage_handler<decay_t <ValueType>>;
@@ -707,7 +728,8 @@ inline bpstd::decay_t<ValueType>&
707
728
}
708
729
709
730
template <typename ValueType, typename U, typename ...Args, typename >
710
- inline bpstd::decay_t <ValueType>&
731
+ inline BPSTD_INLINE_VISIBILITY
732
+ bpstd::decay_t <ValueType>&
711
733
bpstd::any::emplace (std::initializer_list<U> il,
712
734
Args&&...args)
713
735
{
@@ -723,7 +745,8 @@ inline bpstd::decay_t<ValueType>&
723
745
return result;
724
746
}
725
747
726
- inline void bpstd::any::reset ()
748
+ inline BPSTD_INLINE_VISIBILITY
749
+ void bpstd::any::reset ()
727
750
noexcept
728
751
{
729
752
if (m_storage_handler != nullptr ) {
@@ -732,7 +755,8 @@ inline void bpstd::any::reset()
732
755
}
733
756
}
734
757
735
- inline void bpstd::any::swap (any& other)
758
+ inline BPSTD_INLINE_VISIBILITY
759
+ void bpstd::any::swap (any& other)
736
760
noexcept
737
761
{
738
762
using std::swap;
@@ -777,13 +801,15 @@ inline void bpstd::any::swap(any& other)
777
801
// Observers
778
802
// -----------------------------------------------------------------------------
779
803
780
- inline bool bpstd::any::has_value ()
804
+ inline BPSTD_INLINE_VISIBILITY
805
+ bool bpstd::any::has_value ()
781
806
const noexcept
782
807
{
783
808
return m_storage_handler != nullptr ;
784
809
}
785
810
786
- inline const std::type_info& bpstd::any::type ()
811
+ inline BPSTD_INLINE_VISIBILITY
812
+ const std::type_info& bpstd::any::type ()
787
813
const noexcept
788
814
{
789
815
if (has_value ()) {
@@ -801,7 +827,8 @@ inline const std::type_info& bpstd::any::type()
801
827
// utilities
802
828
// -----------------------------------------------------------------------------
803
829
804
- inline void bpstd::swap (any& lhs, any& rhs)
830
+ inline BPSTD_INLINE_VISIBILITY
831
+ void bpstd::swap (any& lhs, any& rhs)
805
832
noexcept
806
833
{
807
834
lhs.swap (rhs);
@@ -812,7 +839,8 @@ inline void bpstd::swap(any& lhs, any& rhs)
812
839
// -----------------------------------------------------------------------------
813
840
814
841
template <typename T>
815
- inline T bpstd::any_cast (any& operand)
842
+ inline BPSTD_INLINE_VISIBILITY
843
+ T bpstd::any_cast (any& operand)
816
844
{
817
845
auto * p = any_cast<T>(&operand);
818
846
if (p == nullptr ) {
@@ -822,7 +850,8 @@ inline T bpstd::any_cast(any& operand)
822
850
}
823
851
824
852
template <typename T>
825
- inline T bpstd::any_cast (any&& operand)
853
+ inline BPSTD_INLINE_VISIBILITY
854
+ T bpstd::any_cast (any&& operand)
826
855
{
827
856
auto * p = any_cast<T>(&operand);
828
857
if (p == nullptr ) {
@@ -832,7 +861,8 @@ inline T bpstd::any_cast(any&& operand)
832
861
}
833
862
834
863
template <typename T>
835
- inline T bpstd::any_cast (const any& operand)
864
+ inline BPSTD_INLINE_VISIBILITY
865
+ T bpstd::any_cast (const any& operand)
836
866
{
837
867
auto * p = any_cast<T>(&operand);
838
868
if (p == nullptr ) {
@@ -842,7 +872,8 @@ inline T bpstd::any_cast(const any& operand)
842
872
}
843
873
844
874
template <typename T>
845
- inline T* bpstd::any_cast (any* operand)
875
+ inline BPSTD_INLINE_VISIBILITY
876
+ T* bpstd::any_cast (any* operand)
846
877
noexcept
847
878
{
848
879
if (!operand) {
@@ -859,7 +890,8 @@ inline T* bpstd::any_cast(any* operand)
859
890
}
860
891
861
892
template <typename T>
862
- inline const T* bpstd::any_cast (const any* operand)
893
+ inline BPSTD_INLINE_VISIBILITY
894
+ const T* bpstd::any_cast (const any* operand)
863
895
noexcept
864
896
{
865
897
if (!operand) {
0 commit comments