Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2002-08-30 11:00:58


From: Douglas Gregor <gregod_at_[hidden]>
> On Friday 30 August 2002 11:12 am, Carlo Wood wrote:
> > - The most general interface is
> >
> > template<typename Allocator>
> > void demangle_type(
> > std::basic_string<char, std::char_traits<char>, Allocator>& output,
> > char const* input,
> > size_t length = 0);
> >
> > Where length is the maximum number of character read from
> > the input, or 0 when input needs to be read till a terminating '\0'.
> >
> Well, if we're really worried about avoiding string copying altogether, we'll
> want to generalize away the string entirely (so we could write directly to a
> stream or into a non-string buffer, for instance). The interface could be
> iterator-based, e.g.,
>
> 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).

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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