9

I'm writing some stuff using the tr1 namespace in VS2008. What will happen when C++xx becomes ratified? Has this happened before with other C++ revisions? Will the tr1 stuff still work or will I have to change all of my include? I realize that I'm making the very large assumption that this ratification will someday occur. I know that most likely none of you work for MS or contribute to GCC, but if you have experience with these kinds of changes, I would appreciate the advice.

Steve
  • 11,763
  • 15
  • 70
  • 103
  • 1
    "other C++ revisions" aren't really comparable. C++03 was basically just a bunch of corrections to C++98. C++0x is the first thing worth calling a new standard, like C99 was, in the sense that for some time there will be a significant division between "implementations which support the new standard" and "implementations which only support the old standard". I didn't use C++ in 2003, but I'd guess the division then was more like "compilers still under any kind of development incorporated the corrigenda as they were raised, and abandoned compilers were never very close to the standard anyway". – Steve Jessop Jan 04 '10 at 22:54
  • Well I did use C++ in 2003 and indeed in 1985 (or at least tried to - I tried to bring up an E release of C++ on the UNIX boxen I was in charge of, and failed) . and all along, the sensible thing for commercial apps has been - don't use the new stuff. –  Jan 04 '10 at 23:07
  • @Neil - its more of an internal tool, but excellent general advice – Steve Jan 05 '10 at 00:20

3 Answers3

10

std::tr1 will become part of std in C++1x (std::tr1::shared_ptr becomes std::shared_ptr, etc). std::tr1 will continue to exist as long as that compiler claims to implement TR1. At some point your compiler may drop that claim, and drop std::tr1 as a result. This probably will never happen.

std::tr1 has already been "copied" into namespace std in Visual Studio 2010 Beta (via a using directive)

Terry Mahaffey
  • 11,775
  • 1
  • 35
  • 44
5

The Wikipedia entry for C++0x says "A large part of the new libraries are defined in the document C++ Standards Committee's Library Technical Report (called TR1), which was published in 2005. Various full and partial implementations of TR1 are currently available using the namespace std::tr1. For C++0x they will be moved to namespace std. However, as TR1 features are brought into the C++0x standard library, they are upgraded where appropriate with C++0x language features that were not available in the initial TR1 version. Also, they may be enhanced with features that were possible under C++03, but were not part of the original TR1 specification."

Permaquid
  • 1,950
  • 1
  • 14
  • 15
  • 5
    And now people are getting upvotes for providing answers that are verbatim quotes from Wikipedia - way to go! –  Jan 04 '10 at 23:42
  • Not only is it verbatim from wikipedia, but it isn't helpful. Even better! If you use std::tr1 now, it will work for a very long time. The value of "very" will vary based on your compiler, but long enough for you go to back through your source and change boost:: or tr1:: to std:: – Nick Bastin Jan 05 '10 at 00:07
  • @Neil: Is there a more preferred method when a verbatim quote from the web presumes to answer the question? – Drew Dormann Jan 05 '10 at 00:14
  • 2
    @Shmoopty Yes, provide a one sentence summary, like "Wikipedia, that well known font of C++ knowledge, says" and then the link. That way, if wikiipedia gets updated, so does SO. That's why this thing is called a "web". –  Jan 05 '10 at 00:21
  • There is a link. The bold section adds to the previous commentary on this page, and I posted this because it was news to me, and I thought it might be either wrong, or news to someone else as well. And as C++0x is not finalized (as I understand it) it might not even happen. I originally thought about just posting a link and suggesting the questioner do appropriate internet searches in standards and related documents, but, you know, it just seemed too patronizing. As for the vote - I would be happy to donate it to anyone who wants it. – Permaquid Jan 07 '10 at 02:34
2

tr1 is not part of any standard (the paper it is shorthand for never was accepted) - it's just a convention that some compilers provide. They will almost certainly go on providing it long into the future.