diff options
author | Determinant <ted.sybil@gmail.com> | 2018-02-03 19:35:43 -0500 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2018-02-03 20:16:07 -0500 |
commit | bc940e3365faad180a536d602f7ae0110515ee68 (patch) | |
tree | e17065bbf615c83531fad8b01dc849b5b1cc59b5 /promise.hpp | |
parent | 86b1bab87e0a4049f6fc9d2fedec323556f5ef27 (diff) |
...
Diffstat (limited to 'promise.hpp')
-rw-r--r-- | promise.hpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/promise.hpp b/promise.hpp index 8fdf14e..1173e87 100644 --- a/promise.hpp +++ b/promise.hpp @@ -27,12 +27,18 @@ #include <vector> #include <memory> #include <functional> - -#if __has_include("any") -#include <any> +#include <type_traits> + +#ifdef __has_include +# if __has_include(<any>) +# include <any> +# ifdef __cpp_lib_any +# define _CPPROMISE_STD_ANY +# endif +# endif #endif -#if !defined(__cpp_lib_any) +#ifndef _CPPROMISE_STD_ANY #include <boost/any.hpp> #endif @@ -41,14 +47,14 @@ * Javascript Promise/A+. */ namespace promise { -#if defined(__cpp_lib_any) +#ifdef _CPPROMISE_STD_ANY using pm_any_t = std::any; template<typename T> constexpr auto any_cast = static_cast<T(*)(const std::any&)>(std::any_cast<T>); using bad_any_cast = std::bad_any_cast; #else -#warning "using boost::any" -#pragma message "using boost::any" +# warning "using boost::any" +# pragma message "using boost::any" using pm_any_t = boost::any; template<typename T> constexpr auto any_cast = static_cast<T(*)(const boost::any&)>(boost::any_cast<T>); |