-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadl.h
47 lines (38 loc) · 1.09 KB
/
adl.h
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
#include <utility>
namespace adl_detail {
using std::begin;
using std::end;
using std::swap;
template<typename C>
auto adl_begin(C&& c) -> decltype(begin(std::forward<C>(c)))
{
return begin(std::forward<C>(c));
}
template<typename C>
auto adl_end(C&& c) -> decltype(end(std::forward<C>(c)))
{
return end(std::forward<C>(c));
}
template<typename T>
void adl_swap(T&& lhs, T&& rhs) noexcept(noexcept(swap(std::declval<T>(),
std::declval<T>())))
{
swap(std::forward<T>(lhs), std::forward<T>(rhs));
}
} // namespace adl_detail
template<typename C>
auto adl_begin(C&& c) -> decltype(adl_detail::adl_begin(std::forward<C>(c)))
{
return adl_detail::adl_begin(std::forward<C>(c));
}
template<typename C>
auto adl_end(C&& c) -> decltype(adl_detail::adl_end(std::forward<C>(c)))
{
return adl_detail::adl_end(std::forward<C>(c));
}
template<typename T>
void adl_swap(T&& lhs, T&& rhs) noexcept(
noexcept(adl_detail::adl_swap(std::declval<T>(), std::declval<T>())))
{
adl_detail::adl_swap(std::forward<T>(lhs), std::forward<T>(rhs));
}