Questions tagged [tr1]

TR1 - C++ Technical Report 1, proposed extensions to the C++ standard library

The Technical Report on C++ Library Extensions (a.k.a ISO/IEC TR 19768) defined a number of new library components for C++, many taken from the Boost project. Nearly all the components in TR1 were included in the C++ 2011 standard.

232 questions
19
votes
3 answers

Difference in performance between map and unordered_map in c++

I have a simple requirement, i need a map of type . however i need fastest theoretically possible retrieval time. i used both map and the new proposed unordered_map from tr1 i found that at least while parsing a file and creating the map, by…
none
19
votes
5 answers

Idiomatic use of std::auto_ptr or only use shared_ptr?

Now that shared_ptr is in tr1, what do you think should happen to the use of std::auto_ptr? They both have different use cases, but all use cases of auto_ptr can be solved with shared_ptr, too. Will you abandon auto_ptr or continue to use it in…
Roel
  • 19,338
  • 6
  • 61
  • 90
17
votes
1 answer

Differences between different flavours of shared_ptr

Are there any differences between boost::shared_ptr, std::tr1::shared_ptr and the upcoming (in C++0x) std::shared_ptr? Will porting from one to another have any overhead or are they basically the same?
Motti
  • 110,860
  • 49
  • 189
  • 262
15
votes
2 answers

TR1 Shared Arrays

I've had a hard time finding references in the TR1 documentation concerning shared arrays. The Boost documentation is fairly clear that there is a significant difference between the C++ "new" and "new[]" expressions. The shared_ptr template is…
Perculator
  • 1,293
  • 1
  • 10
  • 12
14
votes
3 answers

enable_if method specialization

template struct A { A operator%( const T& x); }; template A A::operator%( const T& x ) { ... } How can I use enable_if to make the following specialization happen for any floating point type…
David
  • 27,652
  • 18
  • 89
  • 138
14
votes
2 answers

std::tr1 with visual studio 2017

I have some C++ code that uses some version of Google's GTest framework. This code used to compile fine with Visual Studio 2015. I just upgraded to VS2017, and now I get a bunch of errors like this: error C2039: 'tr1': is not a member of 'std' error…
Dess
  • 2,064
  • 19
  • 35
13
votes
1 answer

Differences between tr1::shared_ptr and boost::shared_ptr?

Are there any difference between tr1::shared_ptr and boost::shared_ptr? If so, what?
Paul Merrill
  • 580
  • 4
  • 14
13
votes
4 answers

Is there any way to have dot (.) match newline in C++ TR1 Regular Expressions?

I couldn't find anything regarding this on http://msdn.microsoft.com/en-us/library/bb982727.aspx. Maybe I could use '[^]+' to match everything but that seems like a hack?
kliao
  • 549
  • 1
  • 6
  • 14
13
votes
4 answers

Importing std::tr1 into std - is it legal? Does it improve portability?

I have C++03 code that looks like this: #include ... std::tr1::unordered_map mystuff; ... I started to wonder that i would suffer later if/when i convert my code to C++11, which (i guess) doesn't have…
anatolyg
  • 26,506
  • 9
  • 60
  • 134
12
votes
3 answers

How to access target of std::tr1::shared_ptr in GDB

How can I access target of a std::tr1::shared_ptr in GDB. This doesn't work: (gdb) p sharedPtr->variableOfTarget If I try with the pointer object itself (p sharedPtr) I get something like this: $1 = std::tr1::shared_ptr (count 2) 0x13c2060 With a…
Pnog is not Pong
  • 175
  • 1
  • 1
  • 8
11
votes
1 answer

Generating number from binomial distribution using C++ TR1

I am trying to use the following code (taken from the internet) to generate numbers from binomial distribution. It compiles but one execution it hangs. (I am using g++ on mac.) Could someone suggest a working code to generate numbers from binomial…
Madhav Jha
  • 863
  • 1
  • 8
  • 26
11
votes
4 answers

some practical uses of mem_fn & bind

Can someone recommend some cool practical uses of tr1's mem_fn and bind utilities? I don't need esoteric c++ for library development. just some application level coding which makes uses of these. any help will be very appreciated.
Fanatic23
  • 3,378
  • 2
  • 28
  • 51
10
votes
4 answers

Using TR1 libraries in GCC and MSVC

I would like to use the TR1 libraries that ship with modern versions of GCC and MSVC, but there are subtle differences: in GCC, I have to say #include std::tr1::shared_ptr X; while in MSVC I have to say #include…
Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
10
votes
6 answers

Is there a standard C++ function object for taking apart a std::pair?

Does anyone know if there's a de-facto standard (i.e., TR1 or Boost) C++ function object for accessing the elements of a std::pair? Twice in the past 24 hours I've wished I had something like the keys function for Perl hashes. For example, it…
Michael Kristofik
  • 34,290
  • 15
  • 75
  • 125
9
votes
3 answers

How to handle evolving c++ std:: namespace? e.g.: std::tr1::shared_ptr vs. std::shared_ptr vs. boost::shared_ptr vs. boost::tr1::shared_ptr

For the code I am currently working on, we sometimes need to compile on some older systems with older compilers (e.g.- we run sims on an older IBM BlueGene/L, who's support contract dictates some quite old C++ compiler). The code itself makes use…
MarkD
  • 4,864
  • 5
  • 36
  • 67
1
2
3
15 16