Nugget
adaptors.h
1 // Copyright (c) Electronic Arts Inc. All rights reserved.
4 
7 
8 
9 #ifndef EASTL_ADAPTORS_H
10 #define EASTL_ADAPTORS_H
11 
12 
13 #include <EASTL/internal/config.h>
14 #include <EASTL/internal/move_help.h>
15 #include <EASTL/type_traits.h>
16 #include <EASTL/iterator.h>
17 
18 #if defined(EA_PRAGMA_ONCE_SUPPORTED)
19  #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
20 #endif
21 
22 EA_DISABLE_VC_WARNING(4512 4626)
23 #if defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+
24  EA_DISABLE_VC_WARNING(5027) // move assignment operator was implicitly defined as deleted
25 #endif
26 
27 
28 namespace eastl
29 {
36  template <typename Container>
38  {
39  template <typename C>
41  : mContainer(eastl::forward<C>(c))
42  {
57  static_assert(eastl::is_same_v<C, Container>, "Reference collapsed deduced type must be the same as the deduced Container type!");
58  }
59 
60  Container mContainer;
61  };
62 
63  template <typename Container>
64  auto begin(const reverse_wrapper<Container>& w) -> decltype(eastl::rbegin(w.mContainer))
65  {
66  return eastl::rbegin(w.mContainer);
67  }
68 
69  template <typename Container>
70  auto end(const reverse_wrapper<Container>& w) -> decltype(eastl::rend(w.mContainer))
71  {
72  return eastl::rend(w.mContainer);
73  }
74 
75  template <typename Container>
76  reverse_wrapper<Container> reverse(Container&& c)
77  {
78  return reverse_wrapper<Container>(eastl::forward<Container>(c));
79  }
80 
81 } // namespace eastl
82 
83 #if defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+
84  EA_RESTORE_VC_WARNING()
85 #endif
86 EA_RESTORE_VC_WARNING()
87 
88 #endif // Header include guard
EA Standard Template Library.
Definition: algorithm.h:288
void reverse(BidirectionalIterator first, BidirectionalIterator last)
Definition: algorithm.h:2714
Definition: TestEABase.cpp:2829
Definition: adaptors.h:38
reverse_wrapper(C &&c)
Definition: adaptors.h:40