-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtupl.hpp
58 lines (48 loc) · 1.83 KB
/
tupl.hpp
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
// Copyright (c) 2022 Lemurian Labs https://lemurianlabs.com/
//
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
//
// Repo: https://github.com/Lemurian-Labs/tupl
#ifndef LML_TUPL_HPP
#define LML_TUPL_HPP
/*
tupl<T...>
==========
tupl is a C++20 tuple type implemented as struct specializations
for a variadic number of members T... up to 16 as provided.
DO NOT EDIT the file 'tupl_impl.hpp'.
The implementation in tupl_impl.hpp is generated by preprocessing
the file tupl_dev/tupl_impl_pre.hpp; edit this if you need to.
If more members are needed then follow instructions in tupl_dev
to generate a file tupl_dev/tupl_impl.hpp
Depends on <concepts> for assignable_from, ranges::swap CPO, etc.
Depends on <compare> for three-way operator <=> comparisons, etc.
(MSVC implementation also depends on <cstdint> for uintptr_t.)
Depends on lml c_array_support project for generic support of array
member comparison and assignment, alongside other regular types.
*/
#include "array_compare.hpp"
#include "array_assign.hpp"
// same_ish<T,U> concept utility (should be in some util lib or std)
template <typename T, typename U>
concept same_ish = std::same_as<U, std::remove_cvref_t<T>>;
// UNREACHABLE: platform-specific annotation for unreachable code
// till there's a portable or standardized annotation (c.f. P2390 P0627)
#ifdef __GNUC__
#define UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER)
#define UNREACHABLE() __assume(false)
#else
#define UNREACHABLE()
#endif
// The header "tupl_impl.hpp" as provided is limited to 'arity' 16.
// If tupl_dev/tupl_impl.hpp exists then is included instead.
//
#if __has_include("tupl_dev/tupl_impl.hpp")
#include "tupl_dev/tupl_impl.hpp"
#else
#include "tupl_impl.hpp"
#endif
#undef UNREACHABLE
#endif