TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
range.hpp
Go to the documentation of this file.
1// Copyright (c) 2018--present, The Simons Foundation
2// This file is part of TRIQS/nda and is licensed under the Apache License, Version 2.0.
3// SPDX-License-Identifier: Apache-2.0
4// See LICENSE in the root of this distribution for details.
5
10
11#pragma once
12
13#include "../traits.hpp"
14
15#include <itertools/itertools.hpp>
16
17#include <ostream>
18#include <type_traits>
19
20namespace nda {
21
26
28 using itertools::range;
29
36 struct ellipsis : range::all_t {};
37
44 inline std::ostream &operator<<(std::ostream &os, range::all_t) noexcept { return os << "_"; }
45
52 inline std::ostream &operator<<(std::ostream &os, ellipsis) noexcept { return os << "___"; }
53
55 template <typename... Args>
57
62 template <typename T>
63 constexpr bool is_range_or_ellipsis = is_any_of<std::remove_cvref_t<T>, range, range::all_t, ellipsis>;
64
66
67} // namespace nda
constexpr bool ellipsis_is_present
Constexpr variable that is true if the parameter pack Args contains an nda::ellipsis.
Definition range.hpp:56
std::ostream & operator<<(std::ostream &os, range::all_t) noexcept
Write nda::range::all_t to a std::ostream as _.
Definition range.hpp:44
constexpr bool is_range_or_ellipsis
Constexpr variable that is true if the type T is either an nda::range, an nda::range::all_t or an nda...
Definition range.hpp:63
static constexpr bool is_any_of
Constexpr variable that is true if type T is contained in the parameter pack Ts.
Definition traits.hpp:52
Mimics Python's ... syntax.
Definition range.hpp:36
Provides type traits for the nda library.