66//
77#ifndef BOOST_SML_HPP
88#define BOOST_SML_HPP
9- #if defined(_MSC_VER) && !defined(__clang__)
10- #define COMPILING_WITH_MSVC
11- #endif
129#if (__cplusplus < 201305L && _MSC_VER < 1900)
1310#error "[Boost].SML requires C++14 support (Clang-3.4+, GCC-5.1+, MSVC-2015+)"
1411#else
15- #define BOOST_SML_VERSION 1'1'0
12+ #define BOOST_SML_VERSION 1'1'1
1613#define BOOST_SML_NAMESPACE_BEGIN \
1714 namespace boost { \
1815 namespace sml { \
19- inline namespace v1_1_0 {
16+ inline namespace v1_1_1 {
2017#define BOOST_SML_NAMESPACE_END \
2118 } \
2219 } \
4441#define __BOOST_SML_TEMPLATE_KEYWORD template
4542#pragma GCC diagnostic push
4643#pragma GCC diagnostic ignored "-Wpedantic"
47- #elif defined(COMPILING_WITH_MSVC )
44+ #elif defined(_MSC_VER) && !defined(__clang__ )
4845#define __BOOST_SML_DEFINED_HAS_BUILTIN
4946#define __has_builtin (...) __has_builtin##__VA_ARGS__
5047#define __has_builtin__make_integer_seq (...) 1
5148#define __BOOST_SML_UNUSED
5249#define __BOOST_SML_VT_INIT
5350#define __BOOST_SML_ZERO_SIZE_ARRAY (...)
5451#define __BOOST_SML_ZERO_SIZE_ARRAY_CREATE (...) __VA_ARGS__ ? __VA_ARGS__ : 1
55- #if ( defined(COMPILING_WITH_MSVC ) && _MSC_VER >= 1910) // MSVC 2017
52+ #if defined(_MSC_VER) && ! defined(__clang__ ) && _MSC_VER >= 1910 // MSVC 2017
5653#define __BOOST_SML_TEMPLATE_KEYWORD template
5754#else
5855#define __BOOST_SML_TEMPLATE_KEYWORD
@@ -125,7 +122,7 @@ struct is_same : false_type {};
125122template <class T >
126123struct is_same <T, T> : true_type {};
127124template <class T , class U >
128- #if defined(COMPILING_WITH_MSVC )
125+ #if defined(_MSC_VER) && !defined(__clang__ )
129126struct is_base_of : integral_constant<bool , __is_base_of(T, U)> {
130127};
131128#else
@@ -136,7 +133,7 @@ decltype(T(declval<TArgs>()...), true_type{}) test_is_constructible(int);
136133template <class , class ...>
137134false_type test_is_constructible (...);
138135template <class T , class ... TArgs>
139- #if defined(COMPILING_WITH_MSVC )
136+ #if defined(_MSC_VER) && !defined(__clang__ )
140137struct is_constructible : decltype (test_is_constructible<T, TArgs...>(0 )) {
141138};
142139#else
@@ -341,7 +338,7 @@ struct missing_ctor_parameter {
341338 operator U () {
342339 return {};
343340 }
344- #if !defined(COMPILING_WITH_MSVC )
341+ #if !defined(_MSC_VER) && !defined(__clang__ )
345342 template <class TMissing , __BOOST_SML_REQUIRES(!aux::is_base_of<pool_type_base, TMissing>::value)>
346343 operator TMissing &() const {
347344 static_assert (missing_ctor_parameter<TMissing>::value,
@@ -414,7 +411,7 @@ template <template <class...> class T, class... Ts>
414411struct size <T<Ts...>> {
415412 static constexpr auto value = sizeof ...(Ts);
416413};
417- #if defined(COMPILING_WITH_MSVC )
414+ #if defined(_MSC_VER) && !defined(__clang__ )
418415constexpr int max_impl () { return 0 ; }
419416constexpr int max_impl (int r) { return r; }
420417constexpr int max_impl (int r, int i) { return r > i ? r : i; }
@@ -461,7 +458,7 @@ auto get_type_name(const char *ptr, index_sequence<Ns...>) {
461458}
462459template <class T >
463460const char *get_type_name () {
464- #if defined(COMPILING_WITH_MSVC )
461+ #if defined(_MSC_VER) && !defined(__clang__ )
465462 return detail::get_type_name<T, 34 >(__FUNCSIG__, make_index_sequence<sizeof (__FUNCSIG__) - 34 - 8 >{});
466463#elif defined(__clang__)
467464 return detail::get_type_name<T, 58 >(__PRETTY_FUNCTION__, make_index_sequence<sizeof (__PRETTY_FUNCTION__) - 58 - 2 >{});
@@ -523,7 +520,6 @@ class queue_event {
523520 }
524521 queue_event &operator =(queue_event &&other) {
525522 dtor (data);
526-
527523 id = other.id ;
528524 dtor = other.dtor ;
529525 move = other.move ;
@@ -1201,7 +1197,7 @@ TPolicy get_policy(aux::pair<T, TPolicy> *);
12011197template <class SM , class ... TPolicies>
12021198struct sm_policy {
12031199 static_assert (aux::is_same<aux::remove_reference_t <SM>, SM>::value, " SM type can't have qualifiers" );
1204- #if defined(COMPILING_WITH_MSVC )
1200+ #if defined(_MSC_VER) && !defined(__clang__ )
12051201 using default_dispatch_policy = policies::jump_table;
12061202#elif defined(__clang__)
12071203 using default_dispatch_policy = policies::jump_table;
@@ -1994,7 +1990,7 @@ template <template <class...> class T>
19941990using defer_queue = back::policies::defer_queue<T>;
19951991template <template <class ...> class T >
19961992using process_queue = back::policies::process_queue<T>;
1997- #if defined(COMPILING_WITH_MSVC )
1993+ #if defined(_MSC_VER) && !defined(__clang__ )
19981994template <class T , class ... TPolicies, class T__ = aux::remove_reference_t <decltype (aux::declval<T>())>>
19991995using sm = back::sm<back::sm_policy<T__, TPolicies...>>;
20001996#else
@@ -2122,7 +2118,7 @@ struct state<TState(history_state)> : state_impl<state<TState(history_state)>> {
21222118 return transition<T, state>{t, *this };
21232119 }
21242120};
2125- #if defined(COMPILING_WITH_MSVC )
2121+ #if defined(_MSC_VER) && !defined(__clang__ )
21262122template <class T , class T__ = aux::remove_reference_t <decltype (aux::declval<T>())>, class = void >
21272123struct state_sm {
21282124 using type = state<T>;
@@ -2593,7 +2589,7 @@ struct transition<state<internal>, state<S2>, front::event<E>, always, none> {
25932589};
25942590}
25952591using _ = back::_;
2596- #if !defined(COMPILING_WITH_MSVC )
2592+ #if !defined(_MSC_VER) && !defined(__clang__ )
25972593template <class TEvent >
25982594constexpr front::event<TEvent> event{};
25992595#else
@@ -2610,15 +2606,15 @@ template <class T>
26102606front::event<back::exception<T>> exception __BOOST_SML_VT_INIT;
26112607using anonymous = back::anonymous;
26122608using initial = back::initial;
2613- #if !defined(COMPILING_WITH_MSVC )
2609+ #if !defined(_MSC_VER) && !defined(__clang__ )
26142610template <class T >
26152611constexpr typename front::state_sm<T>::type state{};
26162612#else
26172613template <class T >
26182614typename front::state_sm<T>::type state __BOOST_SML_VT_INIT;
26192615#endif
26202616inline namespace literals {
2621- #if !defined(COMPILING_WITH_MSVC )
2617+ #if !defined(_MSC_VER) && !defined(__clang__ )
26222618template <class T , T... Chrs>
26232619constexpr auto operator " " _s() {
26242620 return front::state<aux::string<T, Chrs...>>{};
@@ -2649,10 +2645,9 @@ BOOST_SML_NAMESPACE_END
26492645#elif defined(__GNUC__) && defined(__BOOST_SML_DEFINED_HAS_BUILTIN)
26502646#undef __has_builtin
26512647#pragma GCC diagnostic pop
2652- #elif defined(COMPILING_WITH_MSVC ) && defined(__BOOST_SML_DEFINED_HAS_BUILTIN)
2648+ #elif defined(_MSC_VER) && !defined(__clang__ ) && defined(__BOOST_SML_DEFINED_HAS_BUILTIN)
26532649#undef __has_builtin
26542650#undef __has_builtin__make_integer_seq
26552651#endif
2656- #undef COMPILING_WITH_MSVC
26572652#endif
26582653#endif
0 commit comments