Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
Loading...
Searching...
No Matches
configured.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//configured.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//configured.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with configured.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) 2016 - 2021 by Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
22// individual authors of this file include:
23// silviana amethyst, university of wisconsin-eau claire
24//
25// detail/configured.hpp
26
27
33
34#pragma once
35
37
38namespace bertini {
39
40 namespace detail{
41
42
87 template<typename ...Ts>
88 struct Configured
89 {
90 std::tuple<Ts...> configuration_;
91
92 template<typename ... T>
93 Configured(T const& ...t) : configuration_(t...)
94 {}
95
96
97 template<typename T, typename = typename std::enable_if<IsTemplateParameter<T,Ts...>::value>::type>
98 const T& Get() const
99 {
100 return std::get<T>(configuration_);
101 }
102
103 template<typename T, typename = typename std::enable_if<IsTemplateParameter<T,Ts...>::value>::type>
104 void Set(T const& t)
105 {
106 std::get<T>(configuration_) = t;
107 }
108
109 using UsedConfigs = TypeList<Ts...>;
110
111 }; // Configured
112
113 template<typename ...Ts>
114 struct Configured<TypeList<Ts...>> : public Configured<Ts...>
115 {
116 template<typename ... T>
117 Configured(T const& ...t) : Configured<Ts...>(t...)
118 {}
119
120 Configured() : Configured<Ts...>() {}
121
122 };
123
124 #define FORWARD_GET_CONFIGURED \
125 template <typename T> \
126 const T& Get() const \
127 { return Config::template Get<T>();}
128
129 } // namespace detail
130}
Contains the detail/is_template_parameter helper, for checking whether a type is a template parameter...
Definition configured.hpp:89
Definition is_template_parameter.hpp:46
A basic typelist, in the style of Modern C++ Design, but using variadic templates.
Definition typelist.hpp:46