This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Patch: stl_vector.h
On an unrelated note, would we be interested in providing support for
stateful allocators in gcc4?
Also, one more thing that comes to mind is the O(N) complexity of
std::list::size(). Should we provide an option of choosing the
complexity? I'm asking this because I've found myself using list and
then also maintaining a separate counter for fast size lookup.
-Dhruv.
On Sat, 2004-10-16 at 14:17, Paolo Carlini wrote:
> Dhruv Matani wrote:
>
> >http://groups.google.co.in/groups?q=vector+constructor+author:gabriel...
> >
> >
> Ok. We should thank Gaby for this explanation.
>
> Anyway, the basic example, not involving user allocators, still works.
>
> On the other hand:
>
> /usr/local/gcc-exp/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/bits/stl_uninitialized.h:294:
> error: no matching function for call to
> '__gnu_cxx::__mt_alloc<dvector_t, __gnu_cxx::__common_pool_policy<true>
> >::construct(dvector_t*, const int&)'
> /usr/local/gcc-exp/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/ext/mt_allocator.h:613:
> note: candidates are: void
> __gnu_cxx::__mt_alloc_base<_Tp>::construct(_Tp*, const _Tp&) [with _Tp =
> dvector_t]
>
> This is, actually, *another* issue and indeed happens because now (after
> Matt's changes
> this summer) the user-provided allocator is used throughout.
>
> I'm not at all convinced that in _M_initialize_dispatch(__true_type) we
> should always
> cast __value (an integer) to value_type (that is, in the example, a
> dvector_t). Honestly,
> I'm under the impression that we are slightly abusing those overloads...
>
> I think we should ask Matt, in the first place: he is """guilty""" of
> this """regression"""...
>
> Matt, should this testcase compile:
>
> #include <vector>
> #include <ext/pool_allocator.h>
>
> using __gnu_cxx::__pool_alloc;
>
> typedef std::vector<double, __pool_alloc<double> > dvector_t;
> typedef std::vector<dvector_t, __pool_alloc<dvector_t> > matrix_t;
>
> matrix_t m = matrix_t(1, 1);
>
> ???
>
> Thanks,
> Paolo.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs