Last active
January 29, 2017 14:23
-
-
Save deque-blog/a759e896787fe1180fd85bcc7246a3d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using nb = int; | |
using id = std::string; | |
struct add_tag {}; | |
struct mul_tag {}; | |
template<typename Tag, typename R> | |
struct op | |
{ | |
op() = default; | |
template<typename Range> | |
explicit op (Range const& rng) : m_rands(rng.begin(), rng.end()) {} | |
std::vector<R> const& rands() const { return m_rands; } | |
private: | |
std::vector<R> m_rands; | |
}; | |
template<typename R> using add_op = op<add_tag, R>; | |
template<typename R> using mul_op = op<mul_tag, R>; | |
template<typename R> | |
using expression_r = boost::variant<int, id, add_op<R>, mul_op<R>>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment