"Eric Niebler"
template< typename T, typename U = proto::is_proto_expr > struct vector2;
template< typename T > struct vector2
{ BOOST_PROTO_EXTENDS(typename proto::terminal ::type, vector2 , VectorDomain) typedef T value_type;
T & operator [](std::size_t i) { return proto::arg(*this)[i]; }
T const & operator [](std::size_t i) const { return proto::arg(*this)[i]; } };
// Tell proto that in the VectorDomain, all // expressions should be wrapped in vector_expr<> struct VectorDomain : proto::domain< proto::pod_generator< vector_expr > , VectorGrammar > { };
Thanks, this works great. The only problem is that vector<> is intended as a wrapper class, and I just implemented it as an array for convenience in this example. It could have any underlying type, not necessarily an array. Is there a proper way to do this without exposing vector<>'s underlying type?