blob: 79acd1842c6b412dcac032b229ddc5a84303dbfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) Electronic Arts Inc. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_INTERNAL_IN_PLACE_T_H
#define EASTL_INTERNAL_IN_PLACE_T_H
#include <EABase/eabase.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
#endif
namespace eastl
{
namespace Internal
{
struct in_place_tag {};
template <class> struct in_place_type_tag {};
template <size_t> struct in_place_index_tag {};
}
///////////////////////////////////////////////////////////////////////////////
/// in_place_tag
///
/// http://en.cppreference.com/w/cpp/utility/in_place_tag
///
struct in_place_tag
{
in_place_tag() = delete;
private:
explicit in_place_tag(Internal::in_place_tag) {}
friend inline in_place_tag Internal_ConstructInPlaceTag();
};
// internal factory function for in_place_tag
inline in_place_tag Internal_ConstructInPlaceTag() { return in_place_tag(Internal::in_place_tag{}); }
///////////////////////////////////////////////////////////////////////////////
/// in_place_t / in_place_type_t / in_place_index_t
///
/// used to disambiguate overloads that take arguments (possibly a parameter
/// pack) for in-place construction of some value.
///
/// http://en.cppreference.com/w/cpp/utility/optional/in_place_t
///
using in_place_t = in_place_tag(&)(Internal::in_place_tag);
template <class T>
using in_place_type_t = in_place_tag(&)(Internal::in_place_type_tag<T>);
template <size_t N>
using in_place_index_t = in_place_tag(&)(Internal::in_place_index_tag<N>);
///////////////////////////////////////////////////////////////////////////////
/// in_place / in_place<T> / in_place<size_t>
///
/// http://en.cppreference.com/w/cpp/utility/in_place
///
inline in_place_tag in_place(Internal::in_place_tag) { return Internal_ConstructInPlaceTag(); }
template <class T>
inline in_place_tag in_place(Internal::in_place_type_tag<T>) { return Internal_ConstructInPlaceTag(); }
template <std::size_t I>
inline in_place_tag in_place(Internal::in_place_index_tag<I>) { return Internal_ConstructInPlaceTag(); }
} // namespace eastl
#endif // Header include guard
|