Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct Nil {};
- template <typename H, typename T>
- class Cons : public T {
- protected:
- typedef T BaseType;
- H mVal;
- public:
- BaseType &operator()(H aVal) {
- mVal = aVal;
- return *static_cast<BaseType*>(this);
- }
- };
- class Foo : public Cons<int, Cons<char*, Cons<bool, Nil> > >
- {
- };
- // later...
- Foo foo;
- foo(1)("asdf")(false);
Add Comment
Please, Sign In to add comment