~ubuntu-branches/ubuntu/vivid/emscripten/vivid-proposed

« back to all changes in this revision

Viewing changes to system/include/libcxx/__functional_base

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140119141240-nfiw0p8033oitpfz
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include <type_traits>
16
16
#include <typeinfo>
17
17
#include <exception>
 
18
#include <new>
18
19
 
19
20
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20
21
#pragma GCC system_header
23
24
_LIBCPP_BEGIN_NAMESPACE_STD
24
25
 
25
26
template <class _Arg, class _Result>
26
 
struct _LIBCPP_TYPE_VIS unary_function
 
27
struct _LIBCPP_TYPE_VIS_ONLY unary_function
27
28
{
28
29
    typedef _Arg    argument_type;
29
30
    typedef _Result result_type;
30
31
};
31
32
 
32
33
template <class _Arg1, class _Arg2, class _Result>
33
 
struct _LIBCPP_TYPE_VIS binary_function
 
34
struct _LIBCPP_TYPE_VIS_ONLY binary_function
34
35
{
35
36
    typedef _Arg1   first_argument_type;
36
37
    typedef _Arg2   second_argument_type;
37
38
    typedef _Result result_type;
38
39
};
39
40
 
40
 
template <class _Tp> struct _LIBCPP_TYPE_VIS hash;
 
41
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
41
42
 
42
43
template <class _Tp>
43
44
struct __has_result_type
55
56
#else
56
57
template <class _Tp>
57
58
#endif
58
 
struct _LIBCPP_TYPE_VIS less : binary_function<_Tp, _Tp, bool>
 
59
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
59
60
{
60
 
    _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
 
61
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 
 
62
    bool operator()(const _Tp& __x, const _Tp& __y) const
61
63
        {return __x < __y;}
62
64
};
63
65
 
64
66
#if _LIBCPP_STD_VER > 11
65
67
template <>
66
 
struct _LIBCPP_TYPE_VIS less<void>
 
68
struct _LIBCPP_TYPE_VIS_ONLY less<void>
67
69
{
68
 
    template <class _T1, class _T2> _LIBCPP_INLINE_VISIBILITY
 
70
    template <class _T1, class _T2> 
 
71
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
69
72
    auto operator()(_T1&& __t, _T2&& __u) const
70
73
        { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
 
74
    typedef void is_transparent;
71
75
};
72
76
#endif
73
77
 
 
78
// addressof
 
79
 
 
80
template <class _Tp>
 
81
inline _LIBCPP_INLINE_VISIBILITY
 
82
_Tp*
 
83
addressof(_Tp& __x) _NOEXCEPT
 
84
{
 
85
    return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
 
86
}
 
87
 
 
88
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
 
89
// Objective-C++ Automatic Reference Counting uses qualified pointers
 
90
// that require special addressof() signatures. When
 
91
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
 
92
// itself is providing these definitions. Otherwise, we provide them.
 
93
template <class _Tp>
 
94
inline _LIBCPP_INLINE_VISIBILITY
 
95
__strong _Tp*
 
96
addressof(__strong _Tp& __x) _NOEXCEPT
 
97
{
 
98
  return &__x;
 
99
}
 
100
 
 
101
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
 
102
template <class _Tp>
 
103
inline _LIBCPP_INLINE_VISIBILITY
 
104
__weak _Tp*
 
105
addressof(__weak _Tp& __x) _NOEXCEPT
 
106
{
 
107
  return &__x;
 
108
}
 
109
#endif
 
110
 
 
111
template <class _Tp>
 
112
inline _LIBCPP_INLINE_VISIBILITY
 
113
__autoreleasing _Tp*
 
114
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
 
115
{
 
116
  return &__x;
 
117
}
 
118
 
 
119
template <class _Tp>
 
120
inline _LIBCPP_INLINE_VISIBILITY
 
121
__unsafe_unretained _Tp*
 
122
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
 
123
{
 
124
  return &__x;
 
125
}
 
126
#endif
 
127
 
74
128
#ifdef _LIBCPP_HAS_NO_VARIADICS
75
129
 
76
130
#include <__functional_base_03>
366
420
};
367
421
 
368
422
template <class _Tp>
369
 
class _LIBCPP_TYPE_VIS reference_wrapper
 
423
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
370
424
    : public __weak_result_type<_Tp>
371
425
{
372
426
public:
377
431
 
378
432
public:
379
433
    // construct/copy/destroy
380
 
    _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
 
434
    _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
 
435
        : __f_(_VSTD::addressof(__f)) {}
381
436
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
382
437
    private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
383
438
#endif
450
505
 
451
506
#endif  // _LIBCPP_HAS_NO_VARIADICS
452
507
 
 
508
#if _LIBCPP_STD_VER > 11
 
509
template <class _Tp1, class _Tp2 = void>
 
510
struct __is_transparent
 
511
{
 
512
private:
 
513
    struct __two {char __lx; char __lxx;};
 
514
    template <class _Up> static __two __test(...);
 
515
    template <class _Up> static char __test(typename _Up::is_transparent* = 0);
 
516
public:
 
517
    static const bool value = sizeof(__test<_Tp1>(0)) == 1;
 
518
};
 
519
#endif
 
520
 
 
521
// allocator_arg_t
 
522
 
 
523
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
 
524
 
 
525
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
 
526
extern const allocator_arg_t allocator_arg;
 
527
#else
 
528
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
 
529
#endif
 
530
 
 
531
// uses_allocator
 
532
 
 
533
template <class _Tp>
 
534
struct __has_allocator_type
 
535
{
 
536
private:
 
537
    struct __two {char __lx; char __lxx;};
 
538
    template <class _Up> static __two __test(...);
 
539
    template <class _Up> static char __test(typename _Up::allocator_type* = 0);
 
540
public:
 
541
    static const bool value = sizeof(__test<_Tp>(0)) == 1;
 
542
};
 
543
 
 
544
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
 
545
struct __uses_allocator
 
546
    : public integral_constant<bool,
 
547
        is_convertible<_Alloc, typename _Tp::allocator_type>::value>
 
548
{
 
549
};
 
550
 
 
551
template <class _Tp, class _Alloc>
 
552
struct __uses_allocator<_Tp, _Alloc, false>
 
553
    : public false_type
 
554
{
 
555
};
 
556
 
 
557
template <class _Tp, class _Alloc>
 
558
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
 
559
    : public __uses_allocator<_Tp, _Alloc>
 
560
{
 
561
};
 
562
 
 
563
#ifndef _LIBCPP_HAS_NO_VARIADICS
 
564
 
 
565
// allocator construction
 
566
 
 
567
template <class _Tp, class _Alloc, class ..._Args>
 
568
struct __uses_alloc_ctor_imp
 
569
{
 
570
    static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
 
571
    static const bool __ic =
 
572
        is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
 
573
    static const int value = __ua ? 2 - __ic : 0;
 
574
};
 
575
 
 
576
template <class _Tp, class _Alloc, class ..._Args>
 
577
struct __uses_alloc_ctor
 
578
    : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
 
579
    {};
 
580
 
 
581
template <class _Tp, class _Allocator, class... _Args>
 
582
inline _LIBCPP_INLINE_VISIBILITY
 
583
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
 
584
{
 
585
    new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
 
586
}
 
587
 
 
588
template <class _Tp, class _Allocator, class... _Args>
 
589
inline _LIBCPP_INLINE_VISIBILITY
 
590
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
 
591
{
 
592
    new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
 
593
}
 
594
 
 
595
template <class _Tp, class _Allocator, class... _Args>
 
596
inline _LIBCPP_INLINE_VISIBILITY
 
597
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
 
598
{
 
599
    new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
 
600
}
 
601
 
 
602
template <class _Tp, class _Allocator, class... _Args>
 
603
inline _LIBCPP_INLINE_VISIBILITY
 
604
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
 
605
 
606
    __user_alloc_construct_impl( 
 
607
             __uses_alloc_ctor<_Tp, _Allocator>(), 
 
608
             __storage, __a, _VSTD::forward<_Args>(__args)...
 
609
        );
 
610
}
 
611
#endif  // _LIBCPP_HAS_NO_VARIADICS
 
612
 
453
613
_LIBCPP_END_NAMESPACE_STD
454
614
 
455
615
#endif  // _LIBCPP_FUNCTIONAL_BASE