Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/modules/ROOT/pages/tutorial/backmp11-back-end.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ It offers a significant reduction in compilation time and RAM usage, as can be s
| back | 18 | 953 | 7
| back_favor_compile_time | 21 | 1000 | 8
| back11 | 43 | 2794 | 7
| backmp11 | 3 | 229 | 3
| backmp11_favor_compile_time | 3 | 220 | 8
| sml | 12 | 363 | 3
| backmp11 | 3 | 213 | 3
| backmp11_favor_compile_time | 3 | 204 | 8
| sml | 11 | 362 | 3
|=======================================================================


Expand All @@ -34,10 +34,10 @@ It offers a significant reduction in compilation time and RAM usage, as can be s
| | Compile / sec | RAM / MB | Runtime / sec
| back | 68 | 2849 | 23
| back_favor_compile_time | 80 | 2551 | 261
| backmp11 | 10 | 438 | 11
| backmp11_favor_compile_time | 7 | 288 | 26
| backmp11_favor_compile_time_multi_cu | 5 | ~919 | 26
| sml | 48 | 1128 | 11
| backmp11 | 9 | 381 | 11
| backmp11_favor_compile_time | 7 | 285 | 26
| backmp11_favor_compile_time_multi_cu | 5 | ~915 | 26
| sml | 40 | 1056 | 11
|================================================================================


Expand Down
42 changes: 39 additions & 3 deletions include/boost/msm/backmp11/common_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <boost/msm/back/common_types.hpp>
#include <cstddef>

namespace boost { namespace msm { namespace backmp11
namespace boost::msm::backmp11
{

using process_result = back::HandledEnum;
Expand Down Expand Up @@ -85,7 +85,6 @@ class deferred_event
};

using EventSource = back::EventSourceEnum;
using back::HandledEnum;

constexpr EventSource operator|(EventSource lhs, EventSource rhs)
{
Expand Down Expand Up @@ -146,7 +145,44 @@ class basic_unique_ptr
};

} // namespace detail
} // namespace boost::msm::backmp11

}}} // namespace boost::msm::backmp11
namespace boost::msm::back
{

// Bitwise operations for process_result.
// Defined in this header instead of back because type_traits are C++11.
// Defined in the back namespace because the operations have to be in the
// same namespace as HandledEnum.

constexpr HandledEnum operator|(HandledEnum lhs, HandledEnum rhs)
{
return static_cast<HandledEnum>(
static_cast<std::underlying_type_t<HandledEnum>>(lhs) |
static_cast<std::underlying_type_t<HandledEnum>>(rhs)
);
}

constexpr HandledEnum& operator|=(HandledEnum& lhs, HandledEnum rhs)
{
lhs = lhs | rhs;
return lhs;
}

constexpr HandledEnum operator&(HandledEnum lhs, HandledEnum rhs)
{
return static_cast<HandledEnum>(
static_cast<std::underlying_type_t<HandledEnum>>(lhs) &
static_cast<std::underlying_type_t<HandledEnum>>(rhs)
);
}

constexpr HandledEnum& operator&=(HandledEnum& lhs, HandledEnum rhs)
{
lhs = lhs & rhs;
return lhs;
}

} // namespace boost::msm::back

#endif // BOOST_MSM_BACKMP11_COMMON_TYPES_H
Loading