Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-07-19 04:35:01


Gennadiy Rozental wrote:
> Page 4 1.2.3 : "The structure destrubed by types ...". Did you mean
> my_types?

Yes, thanks for noticing.

> Page 5 1.2.3 : In example 1, third comments. Did you mean <=?

Yes.

> Page 6 1.3 : It seems that all_permutation could be
> implemented shorter,
> something like this (not tested!)
>
> // return an array of the N! permutations of x
> template< typename T >
> wrapper< typename permutation_holder<T>::type >
> all_permutations(T const& in)
> {
> wrapper<typename permutation_holder<T>::type> result;
>
> unsigned const N = sizeof(T) / sizeof(**result.x);
> unsigned const result_size = sizeof(result.x) / sizeof(T);
> T* src = &in; // (or &&*in?)
>
> for( T* dst = result.x; dst != result.x + result_size; ++dst )
> {
> std::copy(*src, *src + N, *dst);
> std::next_permutation(*dst, *dst + N);
> src = dst;
> }
> return result;
> }

I'll leave this one to Dave :).

> Page 8 2.1 : Does introduction of mpl::if_ mean that we
> gonna depricate select_type?

Which 'select_type'?

> Page 11 2.1.1 : At the end You discussing the way how to eliminate
> instantiation of boost::remove_pointer. The price for it
> instantiation of mpl::identity. You did not mention it.

Correct. The price is negligible, but it's definitely a worthy point to
mention.

> Page 15 2.2.5. Here you first mention type _1 without any
> qualifier.

It's a simplification. In practice if you want to use numbered MPL
placeholders without any qualification you have to bring them into current
scope:

    using mpl::placeholder;
    typedef mpl::apply< my_f, mpl::find<_1,_2> >::type result;

Alternatively, you can use the unnamed placeholder out-of-box:

    typedef mpl::apply< my_f, mpl::find<_,_> >::type result;

> Would not it cause an ambigility if used simultaniously
> with boost::lambda or boost::bind facility.

No (at least without an explicit using directive).

> In general don't you think we have to
> much _1 all over the place?

On the contrary, I find the similarity of syntax notation between run-time
and compile-time lambda very appealing. My only source of disturbance about
it is that the placeholders cannot be shared :(.

> Page 16 2.3.3 : You introduced tiny_list. I did not get why
> is it Sequece at all. It does not fit to Sequence definition.

In what way?

> Also what is tiny_list_iterator<T,0>::prior (and why not prev?)?

Because we have 'boost::prior()' ("boost/utility.hpp").

> Would not it cause indefinite instantiation.

No. In general, definitions like this

    typedef my_template<t1,..,tn> type;

do no cause the template instantiation. See the standard for details.

> Later you sad that tiny_list model Bidirectional
> sequence, what is unclear without concept definition.

The concepts are defined here -
http://www.mywikinet.com/mpl/ref/Sequences.html. I'll reference it in the
paper.

>
> P.S. BTW user is he or she in english?

MPL user is "she" :).

Aleksey


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