|
Boost : |
From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2002-09-01 14:52:44
On Sun, 1 Sep 2002, Carlo Wood wrote:
> Then I'd really like to go for
>
> namespace boost {
>
> template <typename InputIterator, typename OutputIterator, typename Allocator = std::allocator>
> OutputIterator demangle_type(InputIterator first, InputIterator last, OutputIterator out);
>
> template <typename InputIterator, typename OutputIterator, typename Allocator = std::allocator>
> OutputIterator demangle_symbol(InputIterator first, InputIterator last, OutputIterator out);
>
> }
>
> .. as the primary interface,
Sure. Just to clarify completely, we'll need two overloads of each
function (because there are no default template arguments for function
templates). No more complaints from me :)
> Now I have seen two different opinions:
> 1) People who want stuff like "std::string demangle_type(std::type_info const&)"
> and
> 2) People who said that providing more than one interface (wrappers)
> as part of boost is interface bloat.
>
> I tend to agree with 2). So what shall we do?
> How about I just start with only the main interface? :)
With alternate interfaces, we can only guess at what is useful and what is
bloat. My feeling is that there are two kinds of users for a demangle
library:
1) Simple uses like 'demangle(typeid(T))' for simple debugging output.
No need to customize allocators or deal with multiple kinds of input for
these users.
2) Advanced users that have very strict time/space requirements. These
users need to customize allocation, input type, output style, etc. for
maximum performance/safety/etc.
So, the general interface covers #2, and I suggest this simple interface
to cover #1:
std::string demangle(const std::string& symbol);
std::string demangle(const std::type_info& type);
But this is all trivial once we have the general version :)
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk