Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2005-02-03 01:58:10


Hi Jonathan,

Jonathan Turkanis ha escrito:

> Hi,
>
> I'm trying to use allocator_utilities with VC6 in the following manner:
>
> template<typename Alloc>
> struct bzip2_allocator_traits {
> typedef typename
> boost::detail::allocator::rebind_to<
> Alloc,
> char
> >::type type;
> };
>
> template< typename Alloc,
> typename Base = // VC6 workaround: C2516
> BOOST_DEDUCED_TYPENAME
> bzip2_allocator_traits<Alloc>::type >
> struct bzip2_allocator : private Base { ... };
>
> Unfortunately, I get the error C2039: 'rebind' : is not a member of
> 'fake_allocator<0>'
>

Could you please post a complete snippet showing the problem?
I've tried to reproduce it, but it works here (MSVC++ 6.0 sp 5).
See below.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

#include <boost/detail/allocator_utilities.hpp>

template<typename Alloc>
struct bzip2_allocator_traits{
  typedef typename
     boost::detail::allocator::rebind_to<
       Alloc,
       char
>::type type;
};

template<typename Alloc,
         typename Base = // VC6 workaround: C2516
            BOOST_DEDUCED_TYPENAME
            bzip2_allocator_traits<Alloc>::type
>
struct bzip2_allocator : private Base
{
  char * allocate(std::size_t n){return Base::allocate(n);}
};

typedef bzip2_allocator<std::allocator<struct foo> > my_allocator;

int main()
{
  my_allocator al;

  char* p=al.allocate(1);

  return 0;
}


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