1
0
forked from boostorg/mp11
Files
boost_mp11/doc/mp11/definitions.adoc

54 lines
1.7 KiB
Plaintext
Raw Normal View History

2017-06-07 00:02:25 +03:00
////
Copyright 2017 Peter Dimov
2017-03-17 02:28:03 +02:00
2017-06-07 00:02:25 +03:00
Distributed under the Boost Software License, Version 1.0.
2017-03-17 02:28:03 +02:00
2017-06-07 00:02:25 +03:00
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#definitions]
# Definitions
A _list_ is a -- usually but not necessarily variadic -- template class whose parameters are all types,
2017-03-17 02:28:03 +02:00
for example `mp_list<char[], void>`, `mp_list<>`, `std::tuple<int, float, char>`, `std::pair<int, float>`, `std::shared_ptr<X>`.
2017-06-07 00:02:25 +03:00
A _metafunction_ is a class template or a template alias whose parameters are all types, for example `std::add_pointer_t`,
2017-03-17 02:28:03 +02:00
`std::is_const`, `mp_second`, `mp_push_front`, `mp_list`, `std::tuple`, `std::pair`, `std::shared_ptr`, or
2017-06-10 03:44:31 +03:00
```
template<class...> using F1 = void;
template<class T> using F2 = T*;
template<class... T> using F3 = std::integral_constant<std::size_t, sizeof...(T)>;
```
2017-03-17 02:28:03 +02:00
2017-06-07 00:02:25 +03:00
A _quoted metafunction_ is a class with a public metafunction member called `fn`, for example
2017-03-17 02:28:03 +02:00
2017-06-10 03:44:31 +03:00
```
struct Q1 { template<class...> using fn = void; };
struct Q2 { template<class T> using fn = T*; };
struct Q3 { template<class... T> using fn =
std::integral_constant<std::size_t, sizeof...(T)>; };
```
2017-03-17 02:28:03 +02:00
2017-06-07 00:02:25 +03:00
An _integral constant type_ is a class with a public member `value` that is an integral constant in the C++ sense. For example,
2017-03-17 02:28:03 +02:00
`std::integral_constant<int, 7>`, or
struct N { static int constexpr value = 2; };
2017-06-07 00:02:25 +03:00
A _set_ is a list whose elements are unique.
2017-04-01 19:46:45 +03:00
2017-06-07 00:02:25 +03:00
A _map_ is a list of lists, the inner lists having at least one element (the key.) The keys of the map must be unique. For example,
2017-04-01 19:46:45 +03:00
2017-06-10 03:44:31 +03:00
```
using M1 = std::tuple<std::pair<int, int*>, std::pair<float, float*>,
std::pair<void, void*>>;
using M2 = mp_list<mp_list<int, int*>, mp_list<float>,
mp_list<char, char[1], char[2]>>;
```