decoder_detail: static_assert member function is from visitor class
Improves readability of compiler errors.
This commit is contained in:
parent
c7e5216473
commit
b1bad4b5cc
2 changed files with 4 additions and 1 deletions
|
@ -26,7 +26,8 @@ namespace detail {
|
|||
template<class MatcherT>
|
||||
struct detail {
|
||||
private:
|
||||
using opcode_type = typename MatcherT::opcode_type;
|
||||
using opcode_type = typename MatcherT::opcode_type;
|
||||
using visitor_type = typename MatcherT::visitor_type;
|
||||
|
||||
static constexpr size_t opcode_bitsize = Common::BitSize<opcode_type>();
|
||||
|
||||
|
@ -113,6 +114,7 @@ private:
|
|||
CallRetT (Visitor::* const fn)(Args...),
|
||||
const std::array<opcode_type, sizeof...(iota)> arg_masks,
|
||||
const std::array<size_t, sizeof...(iota)> arg_shifts) {
|
||||
static_assert(std::is_same<visitor_type, Visitor>::value, "Member function is not from Matcher's Visitor");
|
||||
return [fn, arg_masks, arg_shifts](Visitor& v, opcode_type instruction) {
|
||||
(void)instruction;
|
||||
return (v.*fn)(static_cast<Args>((instruction & arg_masks[iota]) >> arg_shifts[iota])...);
|
||||
|
|
|
@ -27,6 +27,7 @@ template <typename Visitor, typename OpcodeType>
|
|||
class Matcher {
|
||||
public:
|
||||
using opcode_type = OpcodeType;
|
||||
using visitor_type = Visitor;
|
||||
using handler_return_type = typename Visitor::instruction_return_type;
|
||||
using handler_function = std::function<handler_return_type(Visitor&, opcode_type)>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue