Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-09-12 17:43:36


"Neal Becker" <ndbecker2_at_[hidden]> wrote in message
news:ci2eu0$r3b$1_at_sea.gmane.org...
| Thorsten Ottosen wrote:
|
| > "Neal Becker" <ndbecker2_at_[hidden]> wrote in message

| > | namespace detail {
| > | template<typename cont_t, typename range>
| > | struct construct_from_range_impl {
| > | cont_t operator() (range const& r) {
| > | return cont_t (boost::begin (r), boost::end (r));
| > | }
| > | };
| >
| > Please see the "Utility" section of the docs. You would be looking for
| > copy_range().
| >
| > | template<typename T, typename range>
| > | struct construct_from_range_impl<boost::numeric::ublas::vector<T>,
| > | range>
| > | {
| > | typedef typename boost::numeric::ublas::vector<T> ret_t;
| > | ret_t operator() (range const& r) {
| > | ret_t v (boost::size (r));
| > | std::copy (boost::begin (r), boost::end (r), v.begin());

| > hm..if ublas support is needed one could either do
| >
| > 1. give ublas classes a constructor that takes two iterators
| > 2. overload copy_range
| >
| > I would prefer 1.
| >
| How would 2 work? copy_range is a function, so can't have a partial
| specialization. How would you overload for converting an arbitrary range
| to ublas::vector<T>?

hm...I see the problem...I guess you can't.

br

Thorsten


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