mlpack
3.1.1
src
mlpack
prereqs.hpp
Go to the documentation of this file.
1
11
#ifndef MLPACK_PREREQS_HPP
12
#define MLPACK_PREREQS_HPP
13
14
// Defining _USE_MATH_DEFINES should set M_PI.
15
#define _USE_MATH_DEFINES
16
#include <cmath>
17
18
// First, check if Armadillo was included before, warning if so.
19
#ifdef ARMA_INCLUDES
20
#pragma message "Armadillo was included before mlpack; this can sometimes cause\
21
problems. It should only be necessary to include <mlpack/core.hpp> and not \
22
<armadillo>."
23
#endif
24
25
// Next, standard includes.
26
#include <cstdlib>
27
#include <cstdio>
28
#include <cstring>
29
#include <cctype>
30
#include <climits>
31
#include <cfloat>
32
#include <cstdint>
33
#include <stdexcept>
34
#include <tuple>
35
#include <utility>
36
37
// But if it's not defined, we'll do it.
38
#ifndef M_PI
39
#define M_PI 3.141592653589793238462643383279
40
#endif
41
42
// Give ourselves a nice way to force functions to be inline if we need.
43
#define force_inline
44
#if defined(__GNUG__) && !defined(DEBUG)
45
#undef force_inline
46
#define force_inline __attribute__((always_inline))
47
#elif defined(_MSC_VER) && !defined(DEBUG)
48
#undef force_inline
49
#define force_inline __forceinline
50
#endif
51
52
// Backport this functionality from C++14, if it doesn't exist.
53
#if __cplusplus <= 201103L
54
#if !defined(_MSC_VER) || _MSC_VER <= 1800
55
namespace
std
{
56
57
template
<
bool
B,
class
T =
void
>
58
using
enable_if_t
=
typename
enable_if<B, T>::type;
59
60
}
61
#endif
62
#endif
63
64
// Increase the number of template arguments for the boost list class.
65
#undef BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
66
#undef BOOST_MPL_LIMIT_LIST_SIZE
67
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
68
#define BOOST_MPL_LIMIT_LIST_SIZE 50
69
70
// We'll need the necessary boost::serialization features, as well as what we
71
// use with mlpack. In Boost 1.59 and newer, the BOOST_PFTO code is no longer
72
// defined, but we still need to define it (as nothing) so that the mlpack
73
// serialization shim compiles.
74
#include <boost/serialization/serialization.hpp>
75
// We are not including boost/serialization/vector.hpp here. It is included in
76
// mlpack/core/boost_backport/boost_backport_serialization.hpp because of
77
// different behaviors of vector serialization in different versions of boost.
78
// #include <boost/serialization/vector.hpp>
79
#include <boost/serialization/map.hpp>
80
// boost_backport.hpp handles the version and backporting of serialization (and
81
// other) features.
82
#include "mlpack/core/boost_backport/boost_backport_serialization.hpp"
83
// Boost 1.59 and newer don't use BOOST_PFTO, but our shims do. We can resolve
84
// any issue by setting BOOST_PFTO to nothing.
85
#ifndef BOOST_PFTO
86
#define BOOST_PFTO
87
#endif
88
#include <
mlpack/core/data/has_serialize.hpp
>
89
#include <
mlpack/core/data/serialization_template_version.hpp
>
90
91
// If we have Boost 1.58 or older and are using C++14, the compilation is likely
92
// to fail due to boost::visitor issues. We will pre-emptively fail.
93
#if __cplusplus > 201103L && BOOST_VERSION < 105900
94
#error Use of C++14 mode with Boost < 1.59 is known to cause compilation \
95
problems. Instead specify the C++11 standard (-std=c++11 with gcc or clang), \
96
or upgrade Boost to 1.59 or newer.
97
#endif
98
99
// On Visual Studio, disable C4519 (default arguments for function templates)
100
// since it's by default an error, which doesn't even make any sense because
101
// it's part of the C++11 standard.
102
#ifdef _MSC_VER
103
#pragma warning(disable : 4519)
104
#define ARMA_USE_CXX11
105
#endif
106
107
// Now include Armadillo through the special mlpack extensions.
108
#include <mlpack/core/arma_extend/arma_extend.hpp>
109
#include <
mlpack/core/util/arma_traits.hpp
>
110
111
// Ensure that the user isn't doing something stupid with their Armadillo
112
// defines.
113
#include <
mlpack/core/util/arma_config_check.hpp
>
114
115
// All code should have access to logging.
116
#include <
mlpack/core/util/log.hpp
>
117
#include <
mlpack/core/util/timers.hpp
>
118
119
// This can be removed with Visual Studio supports an OpenMP version with
120
// unsigned loop variables.
121
#ifdef _WIN32
122
#define omp_size_t intmax_t
123
#else
124
#define omp_size_t size_t
125
#endif
126
127
// We need to be able to mark functions deprecated.
128
#include <
mlpack/core/util/deprecated.hpp
>
129
130
#endif
has_serialize.hpp
arma_traits.hpp
std::enable_if_t
typename enable_if< B, T >::type enable_if_t
Definition:
prereqs.hpp:58
timers.hpp
deprecated.hpp
std
Definition:
prereqs.hpp:55
log.hpp
arma_config_check.hpp
serialization_template_version.hpp
Generated by
1.8.17