mlpack
3.4.2
mlpack-3.4.2
src
mlpack
bindings
tests
delete_allocated_memory.hpp
Go to the documentation of this file.
1
12
#ifndef MLPACK_BINDINGS_IO_DELETE_ALLOCATED_MEMORY_HPP
13
#define MLPACK_BINDINGS_IO_DELETE_ALLOCATED_MEMORY_HPP
14
15
#include <
mlpack/core/util/param_data.hpp
>
16
17
namespace
mlpack
{
18
namespace
bindings {
19
namespace
tests {
20
21
template
<
typename
T>
22
void
DeleteAllocatedMemoryImpl
(
23
util::ParamData
&
/* d */
,
24
const
typename
boost::disable_if<
data::HasSerialize<T>
>::type* = 0,
25
const
typename
boost::disable_if<arma::is_arma_type<T>>::type* = 0)
26
{
27
// Do nothing.
28
}
29
30
template
<
typename
T>
31
void
DeleteAllocatedMemoryImpl
(
32
util::ParamData
&
/* d */
,
33
const
typename
boost::enable_if<arma::is_arma_type<T>>::type* = 0)
34
{
35
// Do nothing.
36
}
37
38
template
<
typename
T>
39
void
DeleteAllocatedMemoryImpl
(
40
util::ParamData
& d,
41
const
typename
boost::disable_if<arma::is_arma_type<T>>::type* = 0,
42
const
typename
boost::enable_if<
data::HasSerialize<T>
>::type* = 0)
43
{
44
// Delete the allocated memory (hopefully we actually own it).
45
delete
*boost::any_cast<T*>(&d.
value
);
46
}
47
48
template
<
typename
T>
49
void
DeleteAllocatedMemory
(
50
util::ParamData
& d,
51
const
void
*
/* input */
,
52
void
*
/* output */
)
53
{
54
DeleteAllocatedMemoryImpl<typename std::remove_pointer<T>::type>(d);
55
}
56
57
}
// namespace tests
58
}
// namespace bindings
59
}
// namespace mlpack
60
61
#endif
mlpack::util::ParamData::value
boost::any value
The actual value that is held.
Definition:
param_data.hpp:82
mlpack::util::ParamData
This structure holds all of the information about a single parameter, including its value (which is s...
Definition:
param_data.hpp:53
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition:
add_to_cli11.hpp:21
mlpack::bindings::tests::DeleteAllocatedMemoryImpl
void DeleteAllocatedMemoryImpl(util::ParamData &, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0)
Definition:
delete_allocated_memory.hpp:22
mlpack::data::HasSerialize
Definition:
has_serialize.hpp:46
mlpack::bindings::tests::DeleteAllocatedMemory
void DeleteAllocatedMemory(util::ParamData &d, const void *, void *)
Definition:
delete_allocated_memory.hpp:49
param_data.hpp
Generated by
1.8.20