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
1
vote
1 answer

VS2012 mixing C and Cpp, library clash

I am trying to combine some C and C++ code in a project, and before I had no issues with this, but I'm now trying out VS2012 for the first time and I get a lot of errors from a TR1 header that I didn't include explicitely. I'm thinking it might be a…
Thijs Koerselman
  • 21,680
  • 22
  • 74
  • 108
1
vote
1 answer

Escape regex special characters for tr1::regex

I need to embed user-input in my regular expression, so it needs to be escaped for any regex special characters, and I don't know in advance what the string will be. It would be something like string pattern = "\\d+ " +…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
1
vote
1 answer

How do I use tr1 function and bind for functions with changing parameters?

I'm currently going from C# to C++ and rewriting some game engine code and I think I'm at a wall with tr1; Essentially what I want to do is have an input layer take input from the touchscreen and then fire a callback to notify any elements listening…
JedH
  • 124
  • 7
1
vote
2 answers

find multiple values in unordered_set using find

I want to use specified equal_to function int unordered_set The sample code likes this: struct myEqual { //string with one different character is considered equal bool operator()(const string &s1, const string &s2)const { …
1
vote
1 answer

GCC 4.1.1 doesn't compile some code with tr1::unordered_map

I have following code to test one concept from a bigger program, and I try to compile with GCC 4.1.1 on Linux. I cannot use newer version of compiler due to corporate environment restrictions and so I have to make it compiling and working with…
ivan.ukr
  • 2,853
  • 1
  • 23
  • 41
1
vote
2 answers

How can I avoid having a hash function impl in my header if I want to use a tr1 unordered map for a custom type?

I need to hash a combination of four different things, comprising 20 bytes, as such I defined this: struct holder { char a; uint16_t b; uint64_t c; char d[9]; } __attribute((__packed__)); and then I can load one of the above and pass it to…
Palace Chan
  • 8,845
  • 11
  • 41
  • 93
1
vote
1 answer

Are there important differences to know about between boost::function and std::tr1::function

I use boost a lot in my code but have so far refrained from using std::tr1. Now I need a more sophisticated function pointer, like those two can provide. Unfortunately C+11 is not an option yet. I read that boost::function can be tricky with certain…
Martin
  • 4,738
  • 4
  • 28
  • 57
1
vote
2 answers

unordered_multimap::equal_range slow

I would expect unordered_multimap::equal_range to be in average constant complexity, however the following does not scale linearly with n as expected: #include #include #include using namespace…
user1531083
  • 750
  • 6
  • 15
1
vote
1 answer

Combining function, bind, c++ and managed code

I have a c++ function which is expecting a function object (AuthenticateNotifyFunc) to be passed to it thus: class lc_Authenticate { public: typedef enum { kAbort, kContinue } lc_AuthenticateStatus; typedef…
user236520
1
vote
1 answer

Generating random numbers using C++ TR1

I am trying to generate random numbers from a normal distribution. When the code: normal(eng) appears in main(), the program works fine. However, if it is called from another function, the next call from main returns the same value generated…
1
vote
2 answers

c++ std::tr1::hash::operator() undefined?

I'm converting a C++ program over from Windows building with Visual C++ 2008 to build on Linux with gcc 4.6.1. There's a module that uses . In VC++, it seems to be perfectly ok to #include…
Ted Middleton
  • 6,859
  • 10
  • 51
  • 71
1
vote
1 answer

Race condition on tr1::randgen() even with #pragma omp critical

Why there is a race condition according to valgrind with the following code? #include #include #include #include using namespace std; tr1::mt19937 randgen; int random(int min, int max) { int number; …
Mario
  • 33
  • 1
  • 4
1
vote
0 answers

Microsoft's level of Unicode support?

What's the std::wregex Unicode support look like for Microsoft Visual C++ 2010? Does it support Unicode character classes? [:Nd:] and such. Support of collations such as digraphs? [.ae.] and such. Microsoft's implementation of std::wregex I am…
unixman83
  • 9,421
  • 10
  • 68
  • 102
1
vote
1 answer

Random engine state and multiple deterministic independent random sequences

The C++ TR1 random number generation scheme has improved the old C runtime library in terms of keeping a separate state for random engines in different threads, or for independent random sequences. The old library has a global state machine, and…
killogre
  • 1,730
  • 15
  • 26
0
votes
1 answer

tr1: boost vs vs2010, using shared_ptr without namespace

trying to compile old project that has many uses of shared_ptr with the vs2010. so, i have precompiled header (stdafx.h) with: .. using namespace std; .. #include "boost/shared_ptr" using namespace boost; and later in the code i…
Sergey Leyko
  • 369
  • 6
  • 14