|
Boost Users : |
Subject: Re: [Boost-users] [boost] [type_erasure] Review started (July 18-27, 2012)
From: Sergey Mitsyn (svm_at_[hidden])
Date: 2012-08-04 11:47:05
On 04.08.2012 16:46, Steven Watanabe wrote:
> 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.
Sorry, my fault - being messing with headers a little.
>
>> 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.
Why is that? AFAIK it's rather easy to determine class template and
template arguments from its instantiation - by passing it to specialized
class template. The "recursive" argument rebinding comes out naturally.
Is there another problem?
>
> 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&);
> };
Ok. Adapting to std::pair<iterator, iterator> return type can be done in
concept_interface specialization. Thanks.
>
> In Christ,
> Steven Watanabe
>
-- ------------ Sergey Mitsyn.
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