整理
This commit is contained in:
30
include/boost/numeric/odeint/tools/assert.hpp
Normal file
30
include/boost/numeric/odeint/tools/assert.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// (C) Copyright Matt Borland 2021 - 2023.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// We deliberately use assert in here:
|
||||
//
|
||||
// boost-no-inspect
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_TOOLS_ASSERT_HPP
|
||||
#define BOOST_NUMERIC_ODEINT_TOOLS_ASSERT_HPP
|
||||
|
||||
#include <boost/numeric/odeint/tools/is_standalone.hpp>
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_STANDALONE
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#define BOOST_NUMERIC_ODEINT_ASSERT(expr) BOOST_ASSERT(expr)
|
||||
#define BOOST_NUMERIC_ODEINT_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg)
|
||||
|
||||
#else // Standalone mode so we use cassert
|
||||
|
||||
#include <cassert>
|
||||
#define BOOST_NUMERIC_ODEINT_ASSERT(expr) assert(expr)
|
||||
#define BOOST_NUMERIC_ODEINT_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
|
||||
|
||||
#endif
|
||||
|
||||
#endif //BOOST_NUMERIC_ODEINT_TOOLS_ASSERT_HPP
|
||||
21
include/boost/numeric/odeint/tools/is_standalone.hpp
Normal file
21
include/boost/numeric/odeint/tools/is_standalone.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright Matt Borland 2021.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_TOOLS_IS_STANDALONE_HPP
|
||||
#define BOOST_NUMERIC_ODEINT_TOOLS_IS_STANDALONE_HPP
|
||||
|
||||
// If one or more of our required dependencies are missing assume we are
|
||||
// in standalone mode
|
||||
|
||||
#ifdef __has_include
|
||||
#if !__has_include(<boost/config.hpp>) || !__has_include(<boost/assert.hpp>) || !__has_include(<boost/lexical_cast.hpp>) || \
|
||||
!__has_include(<boost/throw_exception.hpp>) || !__has_include(<boost/predef/other/endian.h>)
|
||||
# ifndef BOOST_NUMERIC_ODEINT_STANDALONE
|
||||
# define BOOST_NUMERIC_ODEINT_STANDALONE
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif //BOOST_NUMERIC_ODEINT_TOOLS_IS_STANDALONE_HPP
|
||||
39
include/boost/numeric/odeint/tools/traits.hpp
Normal file
39
include/boost/numeric/odeint/tools/traits.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright Matt Borland 2021 - 2023.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_TOOLS_TRAITS
|
||||
#define BOOST_NUMERIC_ODEINT_TOOLS_TRAITS
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
#define BOOST_NUMERIC_ODEINT_HAS_NAMED_TRAIT(trait, name) \
|
||||
template <typename T> \
|
||||
class trait \
|
||||
{ \
|
||||
private: \
|
||||
using yes = char; \
|
||||
struct no { char x[2]; }; \
|
||||
\
|
||||
template <typename U> \
|
||||
static yes test(typename U::name* = nullptr); \
|
||||
\
|
||||
template <typename U> \
|
||||
static no test(...); \
|
||||
\
|
||||
public: \
|
||||
static constexpr bool value = (sizeof(test<T>(0)) == sizeof(char)); \
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace odeint
|
||||
} //namespace numeric
|
||||
} //namespace boost
|
||||
|
||||
#endif //BOOST_NUMERIC_ODEINT_TOOLS_TRAITS
|
||||
Reference in New Issue
Block a user