blob: d27ab66ad4ca4092f9468dbb38166e19fb0fa710 (
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
|
/**
** \file misc/list.hh
** \brief Declaration of misc::list
*/
#pragma once
#include <misc/vector.hh>
/// Wrappers on misc::vectors to provide functional-style list manipulation.
namespace misc::list
{
/// Build a list of a \a head and a \a tail.
template <typename T> vector<T> cons(const T head, const vector<T>& tail);
/// Get the head and tail of the list. Invert of cons.
template <typename T> std::pair<T, vector<T>> snoc(const vector<T>& v);
/// Decompose the list into an array to use structured bindings.
template <std::size_t Size, typename T>
std::array<T, Size> decompose(const vector<T>& v);
} // namespace misc::list
#include <misc/list.hxx>
|