Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] [type_erasure] Review started (July 18-27, 2012)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-08-04 08:46:30


AMDG

On 08/03/2012 02:32 PM, Sergey Mitsyn wrote:
> Hello,
>
> Just some questions:
>
> 1) Missing #include <cassert> in "boost\type_erasure\detail\storage.hpp"
>

This header doesn't use assert.

> 2) Maybe i'm missing something, but it feels like the library doesn't
> support concept function arguments an return types that contain
> placeholder as a template parameter. Imagine a concept that returns
> "std::pair<TIterator, TIterator>", where TIterator is another any:
>
>
>
> template<class TIterator, class C=_self>
> struct foo_concept
> {
> typedef std::pair<TIterator, TIterator> result_type;
> static result_type apply(C& c) {
> return std::make_pair(c.begin(),c.end()); }
> };
>
>
>
>
> Probably the problem is with detail::rebind_placeholders_in_argument.
> The expected behavior is replacing 'TIterator' with something like
> 'std::_Vector_iterator' (or what it should be in specific case), just
> like mpl::lambda replaces its mpl::_N placeholders.
>
> Also I cannot just replace std::pair with another any - I'm trying to
> match the preexisting concepts.
>
> I've put an example into attachment.
>

The library can't handle this without
special knowledge of std::pair. This
would mean creating some kind of extension
point, which I'm not willing to do at this point.

The easiest way to handle this particular
case is to use output parameters

template<class TIterator, class C = _self>
struct foo_concept {
  static void apply(C&, TIterator&, TIterator&);
};

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net