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
0 answers

std::tr1::unordered_map is ordered instead

I'd like to have an unordered_map which contains the occurrences of each key; the problem is that, when I print myMap, it's ordered instead. I know it'd be better to use C++11, but I cannot for some reasons I'm not going to explain. #include…
LordSilver
  • 13
  • 1
  • 1
  • 7
1
vote
1 answer

Cannot order weak_ptr's in in VS10

I can not get 'operator <' to compile for a weak_ptr using VS10. Am I missing an #include or #using? Even the the code sample in the documentation does not work for me. http://msdn.microsoft.com/en-us/library/bb982759.aspx // temp.cpp : Defines the…
jyoung
  • 5,071
  • 4
  • 30
  • 47
1
vote
1 answer

Using unordered_map allocator's not default constructor

I would like to use a different allocator than the default one in unordered_map. For my specific allocator, I want to call another constructor than the default one (I want to pass an int to the constructor). I think the problem is that unordered_map…
hudac
  • 2,584
  • 6
  • 34
  • 57
1
vote
1 answer

Are tr1 headers available for gcc v3.4.6?

Are tr1 headers available for g++ v3.4.6? If so, how can I locate them at compile time. The following is failing to compile: #include With the following error: myModule.h:20:24: tr1/memory: No such file or directory Do I need to move…
WilliamKF
  • 41,123
  • 68
  • 193
  • 295
1
vote
3 answers

On reference_wrapper and callable objects

Given the following callable object: struct callable : public std::unary_function { void operator()() const { std::cout << "hello world" << std::endl; } }; a std::tr1::reference_wrapper<> calls through…
Nicola Bonelli
  • 8,101
  • 4
  • 26
  • 35
1
vote
2 answers

Type problem when including tuple

I'm using Visual Studio 2008 with Feature Pack 1. I have a typedef like this typedef std::tr1::tuple tileInfo with a function like this const tileInfo& GetTile( int x, int y ) const. In the implementation file the…
Person
  • 429
  • 1
  • 8
  • 16
1
vote
1 answer

‘hash’ is already declared in this scope using tr1::hash;

I am trying to compile C++ code shown below but I got an error saying, In file included from src/LM.h:3:0, from src/LM.cpp:1: src/common.h:30:13: error: ‘hash’ is already declared in this scope using tr1::hash; This is the…
hitochan
  • 1,028
  • 18
  • 34
1
vote
1 answer

Containers of reference_wrappers (comparison operators required?)

If you use stl containers together with reference_wrappers of POD types, code such as the following works just fine: int i = 0; std::vector< boost::reference_wrapper > is; is.push_back(boost::ref(i)); std::cout <<…
kloffy
  • 2,928
  • 2
  • 25
  • 34
1
vote
2 answers

How do you get shared_ptr weak count?

Is it possible to get the weak reference count to a shared_ptr? I know how I can get the shared_ptr use count using std::shared_ptr::use_count but I would like to know if there are any non-implementation specific ways to get the number of…
Juan
  • 3,667
  • 3
  • 28
  • 32
1
vote
0 answers

Error with google-sparsehash in mac os x mavericks 10.9.3

I'm compiling a C++ project that depends on google-sparsehash. So I did install sparse through brew install google-sparsehash --cc=gcc-4.2 command. But, when I finally compile my project I got fatal error: 'tr1/functional' file not found. I'd like…
Saulo Ricci
  • 776
  • 1
  • 8
  • 27
1
vote
1 answer

Extracting a raw pointer from a shared_ptr

Is it possible to extract a raw pointer from a std::shared_ptr or std::tr1::shared_ptr object? The intent is to tell the smart pointer object that I don't want it to manage the lifetime of the object anymore. The context is that I have an API that…
341008
  • 9,862
  • 11
  • 52
  • 84
1
vote
2 answers

tr1::regex Regular Expression throwing exception on a nested braces

My regular expression with a '}' is throwing exception when I use the microsoft tr1::regex. But the same regex work fine with other regular expression interpreters. Here is the simplified sample code. string source = "{james}"; string exp =…
S_R
  • 493
  • 1
  • 9
  • 22
1
vote
1 answer

Boost shared_ptr issue with TR1 libraries

class MyClass{ public: MyClass() {} virtual ~MyClass() {} }; extern "C" int foo(int tryNumber) { std::tr1::shared_ptr myClass(new MyClass()); std::cout << "Object has been created " << tryNumber << << std::endl; return…
Alexey Teplyakov
  • 316
  • 3
  • 10
1
vote
2 answers

Crash when calling std::function from std::vector c++

When I do this I get this error Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared…
DogDog
  • 4,820
  • 12
  • 44
  • 66
1
vote
0 answers

C++ - Casting a base class shared_ptr to a derived class shared_ptr

I tried reading through some topics that might have had the answer I was looking for, but I didn't get an answer. In any case. I have a class that holds a vector of shared_ptr's to a base (interface) class: IInputDevice. Here is the member vector in…
Oyvind Andersson
  • 362
  • 6
  • 22