TRIQS/triqs_modest
3.3.0
Brillouin zone summation
Loading...
Searching...
No Matches
to_vector.hpp
Go to the documentation of this file.
1
// Copyright (c) 2025--present, The Simons Foundation
2
// This file is part of TRIQS/modest and is licensed under the terms of GPLv3 or later.
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
// See LICENSE in the root of this distribution for details.
5
6
#pragma once
7
#include <vector>
8
9
namespace
triqs
{
10
11
template
<
typename
T>
auto
to_vector
(
auto
&&gen) {
12
std::vector<T> res;
13
for
(
auto
&&x : gen)
14
if
constexpr
(
requires
{ as<T>(x); })
15
res.push_back(as<T>(x));
16
else
17
res.push_back(T{x});
18
return
res;
19
}
20
21
}
// namespace triqs
triqs
Definition
streams.hpp:11
triqs::to_vector
auto to_vector(auto &&gen)
Definition
to_vector.hpp:11
triqs_modest
utils
to_vector.hpp
Generated by
1.9.8