Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2002-08-30 11:28:18


On Fri, Aug 30, 2002 at 12:00:58PM -0400, Rob Stewart wrote:
> From: Douglas Gregor <gregod_at_[hidden]>
> > On Friday 30 August 2002 11:12 am, Carlo Wood wrote:
> > template<typename InputIterator, typename Allocator, typename OutputIterator>
> > OutputIterator demangle_type(InputIterator first, InputIterator last,
> > const Allocator& allocator, OutputIterator out);
>
> I consider this approach inspired. I would eliminate the
> Allocator parameter, as I don't really think the library needs it
> (still to be determined, of course). This interface provides
> maximal generality, isolates output cleanly, and avoids the
> memory allocation problem (on output anyway).

I like it too.

However, the Allocator is needed as I will need to store
things internally (substitutions, template parameter lists).
There is no reason not to add it as this is a template already
anyway.

We could though put it at the end and provide a default allocator.

template<typename InputIterator, typename OutputIterator, typename Allocator = std::allocator<char> >
  OutputIterator
  demangle_type(InputIterator first, InputIterator last, OutputIterator out);

would do the job for me.

Do we really need to pass a 'const Allocator& allocator'? All I need is
the Alloctor type (for:

template<typename T>
  std::vector<T, typename Allocator::rebind<T>::other>

and

std::basic_string<char, ::std::char_traits<char>, Allocator>

)

-- 
Carlo Wood <carlo_at_[hidden]>

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