Skip to content

Instantly share code, notes, and snippets.

@JohanMabille
Last active January 3, 2020 01:00
Show Gist options
  • Save JohanMabille/792ef3e55036265739e98e4bbf204a80 to your computer and use it in GitHub Desktop.
Save JohanMabille/792ef3e55036265739e98e4bbf204a80 to your computer and use it in GitHub Desktop.
template <class F, class... CT>
class xfunction_stepper
{
public:
using xfunction_type = xfunction<F, CT...>;
using value_type = typename xfunction_type::value_type;
using reference = typename xfunction_type::value_type;
using pointer = typename xfunction_type::const_pointer;
using size_type = typename xfunction_type::size_type;
using difference_type = typename xfunction_type::difference_type;
template <class... St>
xfunction_stepper(const xfunction_type* func, St&&... st) noexcept;
void step(size_type dim, size_type n = 1);
void step_back(size_type dim, size_type n = 1);
void reset(size_type dim);
void reset_back(size_type dim);
void to_begin();
void to_end(layout_type l);
reference operator*() const;
private:
template <std::size_t... I>
reference deref_impl(std::index_sequence<I...>) const;
const xfunction_type* p_f;
std::tuple<typename std::decay_t<CT>::const_stepper...> m_st;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment