Thread: is TR1 and boost the same thing?

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    284

    is TR1 and boost the same thing?

    or does TR1 belong to boost?

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    No, TR1 is the next version of C++ standard. Boost is just a set of free libraries, although some of the things in TR1 came from Boost.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    May I ask why it is called boost::TR1?

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    TR1 is "Technical Report 1" that was approved by the standards committee as semi-official additions to augment the standard library. So a bunch of things were approved that are a part of TR1 that library implementors can implement and distribute to users or with compilers. TR1 defines a common interface much like the regular standard does, so that users can write code to the TR1 interface and expect it to work even when they switch to different implementations of TR1. Note that TR1 is not the next version of the standard, as cpjust mentioned. It is just a group of approved libraries to hold people over until the next standard is official.

    Boost is a group of libraries created and approved by the Boost organization. Boost is not directly affiliated with the standards committee. Libraries in Boost are generally only implemented in Boost, not in other vendor's libraries.

    The relationship between them is that many of the interfaces from the Boost library were used TR1. The reason is that Boost is widely used and tested in actual code, and interfaces that have already been implemented and are already being used are generally better to be standardized than new interfaces.

    So some things, like shared_ptr, were implemented in Boost, then included in TR1 as well. So if you want to use shared_ptr, you can use shared_ptr from Boost, or you can use shared_ptr from any other implementation of TR1.

    In addition, there are other parts of TR1 that aren't in Boost (at least I think so, Boost may have finished a complete implementation of the TR1 libraries). There are many libraries in Boost that are not in TR1.

    In the end, if something is part of TR1, then using it is a good idea, since TR1 is almost standard. If you can't find what you need in TR1, then try Boost because even if it doesn't become standard, Boost is highly respected and widely used.

    The reason you see Boost::TR1 is because as I sort of mentioned, Boost has an implementation of TR1. If you want to use TR1, you can use Boost's version. You can also use the one from Dinkumware, and if any other library vendors implement it you can use those as well.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Raigne View Post
    May I ask why it is called boost::TR1?
    boost::TR1 is just a part of Boost.

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    Thanks all. May I ask if there is "std::TR1"?
    What in TR1 do you most oftenly used?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    May I ask if there is "std::TR1"?
    Yes, that is what is officially known as TR1.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    When (if) they ever do finally release the new C++ standard, where are all those TR1 libraries going to be? Will they keep them in a TR1 namespace forever, or will they be moved to std:: or something other than TR1?

  9. #9
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    That's up to the committee. However, in general terms, it's a fair bet those things in TR1 that make it into the final standard will probably be moved into std.

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I've seen experts give advice on how to use std::tr1 so that code will require minimal changes when those libraries are added to std. Something about making a namespace alias. However, even when they put them in std I would imagine that they would remain in std::tr1 as well but deprecated.

    Of course, this all assumes that the libraries make it into the standard without any changes, which is not a guarantee.

  11. #11
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Daved View Post
    However, even when they put them in std I would imagine that they would remain in std::tr1 as well but deprecated.
    I strongly doubt that. Deprecation is used to flag features that are in an existing standard for removal from a future version of that standard. std::tr1 is not in any ratified standard, so there is no need to deprecate it.

    I'd be more inclined to bet on a situation like the <iostream.h> header. That header only ever existed in draft standards, but the standard (as ratified) only has reference to <iostream>. Several compilers (or, more accurately their libraries) support <iostream.h> for historical reasons (such as avoiding breaking code that dates from the time of those draft standards, and was supported by compilers at the time). However, <iostream.h>, as far as the ratified standard is concerned, is never mentioned and has never existed.

  12. #12
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    That's certainly possible. But given that the same standards committee was the one that approved Tr1, I think they might also make mention of it.

    Either way will effectively be the same, though, as library writers will likely still provide implementations in the std::tr1 namespace for a while after C++0x is implemented.

  13. #13
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    What did they do in previous standards before & after they were released? Did they ever have any sort of TR1 before, or was everything in std:: right from the start?

  14. #14
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cpjust View Post
    What did they do in previous standards before & after they were released? Did they ever have any sort of TR1 before, or was everything in std:: right from the start?
    There was no std:: in the beginning. Everything was in the global namespace.

  15. #15
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    They had std from the start. There has been only one standard. Before the language was standardized there was no std namespace. Libraries that supported both standard and pre-standard C++ provided both options, but they were in different headers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-06-2008, 10:41 AM