TRIQS/itertools
1.3.0
C++ range library
Loading...
Searching...
No Matches
sentinel.hpp
Go to the documentation of this file.
1
// Copyright (c) 2024 Simons Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0.txt
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
// Authors: Thomas Hahn, Olivier Parcollet, Nils Wentzell, chuffa
16
22
#ifndef _ITERTOOLS_SENTINEL_HPP
23
#define _ITERTOOLS_SENTINEL_HPP
24
25
#include <utility>
26
27
namespace
itertools {
28
38
template
<
typename
Iter>
struct
sentinel_t
{
40
Iter
it
;
41
};
42
50
template
<
typename
Iter> [[nodiscard]]
sentinel_t<Iter>
make_sentinel
(Iter it) {
return
{std::move(it)}; }
51
54
}
// namespace itertools
55
56
#endif
// _ITERTOOLS_SENTINEL_HPP
itertools::make_sentinel
sentinel_t< Iter > make_sentinel(Iter it)
Create an itertools::sentinel_t from an iterator using template type deduction.
Definition
sentinel.hpp:50
itertools::sentinel_t
Generic sentinel type that can be used to mark the end of a range.
Definition
sentinel.hpp:38
itertools::sentinel_t::it
Iter it
End iterator of some range.
Definition
sentinel.hpp:40
itertools
sentinel.hpp
Generated by
1.12.0