mlpack 3.4.2
delete_allocated_memory.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_BINDINGS_CLI_DELETE_ALLOCATED_MEMORY_HPP
13#define MLPACK_BINDINGS_CLI_DELETE_ALLOCATED_MEMORY_HPP
14
16
17namespace mlpack {
18namespace bindings {
19namespace cli {
20
21template<typename T>
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
30template<typename T>
32 util::ParamData& /* d */,
33 const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
34{
35 // Do nothing.
36}
37
38template<typename T>
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 typedef std::tuple<T*, std::string> TupleType;
46 delete std::get<0>(*boost::any_cast<TupleType>(&d.value));
47}
48
49template<typename T>
52 const void* /* input */,
53 void* /* output */)
54{
55 DeleteAllocatedMemoryImpl<typename std::remove_pointer<T>::type>(d);
56}
57
58} // namespace cli
59} // namespace bindings
60} // namespace mlpack
61
62#endif
void DeleteAllocatedMemory(util::ParamData &d, const void *, void *)
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)
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:53
boost::any value
The actual value that is held.
Definition: param_data.hpp:82