Boost logo

Boost :

Subject: [boost] [type_erasure] RFC: New version
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-05-12 22:49:46


AMDG

I've just committed an updated version of
my type_erasure library to the sandbox
at http://svn.boost.org/svn/boost/sandbox/type_erasure.

Highlights of this version:

* Simplified primitive concept definitions.
  Now, all it takes is:

template<class T = _self>
struct incrementable {
    static void apply(T& t) { ++t; }
};

* Support for associated types
  and same_type. This allows
  defining iterator concepts
  in a uniform way:

typedef mpl::vector<
  forward_iterator<>,
  same_type<forward_iterator<>::value_type, _a>,
  copy_constructible<_a>,
  typeid_<_a>
> concept;

std::vector<int> vec(10);
for(any<concept> first(vec.begin()), last(vec.end());
  first != last; ++first)
{
    std::cout << any_cast<int&>(*first) << std::endl;
}

Now, _a automatically binds to int.

The core library is now feature complete.
Once I finish updating the iterator
concepts, I think this should be ready
for a formal review. Any thoughts, comments,
or criticism is greatly appreciated.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk