Commit b50a52c2 authored by Jan Koniarik's avatar Jan Koniarik
Browse files

added for each function and constructor for protocol map

parent 30151f41
......@@ -79,6 +79,12 @@ public:
template < key_type Key >
using reg_def_type = typename reg_type< Key >::def_type;
protocol_register_map() = default;
protocol_register_map( Regs::value_type... args )
: registers_( Regs{ args }... )
{
}
template < key_type Key >
reg_value_type< Key > get_val() const
{
......@@ -154,4 +160,13 @@ public:
}
};
template < typename Map, typename UnaryFunction >
inline void protocol_for_each_register( const Map& m, UnaryFunction&& f )
{
em::for_each_index< Map::registers_count >( [&]< std::size_t i >() {
static constexpr auto key = Map::register_key( bounded_constant< i > );
f.template operator()< key >( m.template get_val< key >() );
} );
}
} // namespace emlabcpp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment