TRIQS/nda
2.0.0
Multi-dimensional array library for C++
Toggle main menu visibility
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
20
namespace
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>
56
constexpr
bool
ellipsis_is_present
=
is_any_of<ellipsis, std::remove_cvref_t<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
nda::ellipsis_is_present
constexpr bool ellipsis_is_present
Constexpr variable that is true if the parameter pack Args contains an nda::ellipsis.
Definition
range.hpp:56
nda::operator<<
std::ostream & operator<<(std::ostream &os, range::all_t) noexcept
Write nda::range::all_t to a std::ostream as _.
Definition
range.hpp:44
nda::is_range_or_ellipsis
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
nda::is_any_of
static constexpr bool is_any_of
Constexpr variable that is true if type T is contained in the parameter pack Ts.
Definition
traits.hpp:53
nda::ellipsis
Mimics Python's ... syntax.
Definition
range.hpp:36
traits.hpp
Provides type traits for the nda library.
nda
layout
range.hpp
Generated by
1.17.0