This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: list of "canonical" typedefs?


On 27 August 2012 18:54, Tom Tromey wrote:
> A while ago Benjamin pointed out that ptype (in gdb) can result in
> crazily voluminous output for "simple" types.  For example I've appended
> the output of ptype for a variable whose type is
> std::unordered_set<std::string>.
>
> I've been working on a gdb patch to fix this.  I made a lot of progress
> just by considering template arguments and typedefs local to the class.
>
> However, I think gdb could go a bit beyond this and let libraries
> specify "type name substitutions" -- a kind of simple pretty-printing
> for types.
>
> I have all this working, too, but I find I don't actually know what
> typedefs libstdc++ provides that you would consider canonical -- that
> is, names which should be printed to users by default.
>
> My current list is:
>
>     for name in ('std::istream', 'std::ostream', 'std::iostream',
>                  'std::string', 'std::wstring'):
>
> What other ones are there?

See below for some more.

Would this only apply to typedefs?

Because it would also be useful to ignore template parameters that
have their default values, e.g. print std::vector<A> instead of
std::vector<A , std::allocator<A>>, and std::map<A, B> instead of
std::map<A, B, std::less<A>, std::allocator<std::pair<const A, B>>>

typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
typedef  basic_streambuf<char> streambuf;
typedef basic_istream<char> istream;
typedef basic_ostream<char> ostream;
typedef basic_iostream<char> iostream;
typedef basic_stringbuf<char> stringbuf;
typedef basic_istringstream<char> istringstream;
typedef basic_ostringstream<char> ostringstream;
typedef basic_stringstream<char> stringstream;
typedef basic_filebuf<char> filebuf;
typedef basic_ifstream<char> ifstream;
typedef basic_ofstream<char> ofstream;
typedef basic_fstream<char> fstream;
typedef basic_streambuf<wchar_t> wstreambuf;
typedef basic_istream<wchar_t> wistream;
typedef basic_ostream<wchar_t> wostream;
typedef basic_iostream<wchar_t> wiostream;
typedef basic_stringbuf<wchar_t> wstringbuf;
typedef basic_istringstream<wchar_t> wistringstream;
typedef basic_ostringstream<wchar_t> wostringstream;
typedef basic_stringstream<wchar_t> wstringstream;
typedef basic_filebuf<wchar_t> wfilebuf;
typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
template <class state> class fpos;
typedef fpos<char_traits<char>::state_type> streampos;
typedef fpos<char_traits<wchar_t>::state_type> wstreampos;

typedef basic_regex<char> regex;
typedef basic_regex<wchar_t> wregex;

typedef sub_match<const char*> csub_match;
typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<string::const_iterator> ssub_match;
typedef sub_match<wstring::const_iterator> wssub_match;

typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<string::const_iterator> smatch;
typedef match_results<wstring::const_iterator> wsmatch;

typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;

typedef regex_token_iterator<const char*> cregex_token_iterator;
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]