[cfe-dev] Suggestion for C++ migration tool: tr1 removal

Jeffrey Walton noloader at gmail.com
Thu Feb 28 16:25:58 PST 2013


On Thu, Feb 28, 2013 at 7:11 PM, Vane, Edwin <edwin.vane at intel.com> wrote:
> Would you log an enhancement in bugzilla too?
>
> -----Original Message-----
> From: Marshall Clow [mailto:mclow.lists at gmail.com]
> Sent: Thursday, February 28, 2013 5:07 PM
> To: cfe-dev at cs.uiuc.edu Developers
> Cc: Vane, Edwin; klimek at google.com
> Subject: Suggestion for C++ migration tool: tr1 removal
>
> TR1 was a very successful add-on to C++03.
> However, most (if not all) of the bits of TR1 are now part of the C++11 standard.
>
> Some c++11 standard library implementations include the TR1 features (libstdc++, Dinkumware), while others (libc++) do not.
>
> I think it would be great if the c++11 migration tool "migrated" away from using tr1 features in favor of using the ones in std.
>
> For example:
>
>     #include <tr1/unordered_map>
>     int main()
>     {
>         std::tr1::unordered_map <int, int> ma;
>         std::cout << ma.size () << std::endl;
>         return 0;
>     }
>
> should be rewritten to:
>
>     #include <unordered_map>
>     int main()
>     {
>         std::unordered_map <int, int> ma;
>         std::cout << ma.size () << std::endl;
>         return 0;
>     }
>
>
> and so on.
>
> Comments?
TR1/nonTR1  plagues our code base. I would warmly welcome consistency.

#if defined(OS_APPLE) || defined(CXX_CLANG)
# include <tr1/memory>
using std::tr1::shared_ptr;
#else
# include <memory>
using std::shared_ptr;
#endif

Total pollution in 2013.

Jeff



More information about the cfe-dev mailing list