mlpack 3.4.2
fixed.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_CORE_HPT_FIXED_HPP
13#define MLPACK_CORE_HPT_FIXED_HPP
14
15#include <type_traits>
16
17#include <mlpack/core.hpp>
18
19namespace mlpack {
20namespace hpt {
21
22template<typename>
23struct PreFixedArg;
24
35template<typename T>
37{
38 return PreFixedArg<T>{std::forward<T>(value)};
39}
40
51template<typename T, size_t I>
53{
55 static const size_t index = I;
56
58 const T& value;
59};
60
70template<typename T>
72{
73 using Type = T;
74
75 const T value;
76};
77
84template<typename T>
85struct PreFixedArg<T&>
86{
87 using Type = T;
88
89 const T& value;
90};
91
95template<typename T>
97{
98 template<typename>
99 struct Implementation : std::false_type {};
100
101 template<typename Type>
102 struct Implementation<PreFixedArg<Type>> : std::true_type {};
103
104 public:
105 static const bool value = Implementation<typename std::decay<T>::type>::value;
106};
107
108} // namespace hpt
109} // namespace mlpack
110
111#endif
A type function for checking whether the given type is PreFixedArg.
Definition: fixed.hpp:97
static const bool value
Definition: fixed.hpp:105
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
PreFixedArg< T > Fixed(T &&value)
Mark the given argument as one that should be fixed.
Definition: fixed.hpp:36
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
A struct for storing information about a fixed argument.
Definition: fixed.hpp:53
const T & value
The value of the fixed argument.
Definition: fixed.hpp:58
static const size_t index
The index of the fixed argument.
Definition: fixed.hpp:55
A struct for marking arguments as ones that should be fixed (it can be useful for the Optimize method...
Definition: fixed.hpp:72