What will happen to namespace tr1 when c++ xx is approved?
Asked Answered
D

3

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.

Deadman answered 4/1, 2010 at 22:31 Comment(3)
"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".Admix
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.Revalue
@Neil - its more of an internal tool, but excellent general adviceDeadman
N
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)

Nag answered 4/1, 2010 at 23:10 Comment(0)
C
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."

Cattery answered 4/1, 2010 at 23:5 Comment(5)
And now people are getting upvotes for providing answers that are verbatim quotes from Wikipedia - way to go!Revalue
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::Terrence
@Neil: Is there a more preferred method when a verbatim quote from the web presumes to answer the question?Guardhouse
@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".Revalue
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.Cattery
R
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.

Revalue answered 4/1, 2010 at 22:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.