tr1 Questions

4

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. ...
Sidedress asked 14/4, 2012 at 20:36

6

Solved

I ran across enable_shared_from_this while reading the Boost.Asio examples and after reading the documentation I am still lost for how this should correctly be used. Can someone please give me an e...
Isometrics asked 3/4, 2009 at 1:46

6

Solved

For one class I want to store some function pointers to member functions of the same class in one map storing std::function objects. But I fail right at the beginning with this code: #include <f...
Abductor asked 28/9, 2011 at 11:30

4

Solved

I'm trying to write some portable C++ library code that will initially rely on Boost.Regex, and then move to TR1 as compilers support it, and eventually to the C++0x specification after things get ...
Incomputable asked 25/7, 2009 at 8:53

3

Solved

template<typename T> struct A { A<T> operator%( const T& x); }; template<typename T> A<T> A<T>::operator%( const T& x ) { ... } How can I use enable_if to ...
Varve asked 8/7, 2011 at 16:43

3

Solved

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 thi...
Collazo asked 23/7, 2014 at 17:55

2

Solved

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...
Phyllis asked 17/3, 2017 at 0:22

0

Some background: Extending namespace std is undefined-behaviour(UB) unless it is a template specialization [1]: It is undefined behavior to add declarations or definitions to namespace std or ...
Tennessee asked 8/2, 2018 at 11:28

11

Solved

How can I write a wrapper that can wrap any function and can be called just like the function itself? The reason I need this: I want a Timer object that can wrap a function and behave just like t...
Philpot asked 18/5, 2009 at 19:38

4

Solved

I've been thinking about using shared pointers, and I know how to implement one myself--Don't want to do it, so I'm trying std::tr1::shared_ptr,and I have couple of questions... How is the referen...
Prickly asked 8/2, 2012 at 20:12

3

Solved

I want to put the result of this: std::tr1::mem_fn(&ClassA::method); Inside a variable, what is the type of this variable ? That will look something like this: MagicalType fun = std::tr1::...
Hippopotamus asked 2/8, 2010 at 17:52

7

Solved

This question also applies to boost::function and std::tr1::function. std::function is not equality comparable: #include <functional> void foo() { } int main() { std::function<void()>...
Tergiversate asked 2/9, 2010 at 18:1

3

Solved

There is lots of sweet stuff in TR2. Is that going to be in C++17? I understand that TR1 was completed in 2005 and had to wait until C++11 to be standardized. But I also understand that TR2 is alr...
Gillette asked 21/11, 2014 at 20:15

2

Solved

I understand how to use weak_ptr and shared_ptr. I understand how shared_ptr works, by counting the number of references in its object. How does weak_ptr work? I tried reading through the boost sou...
Williford asked 15/4, 2011 at 0:35

1

Solved

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 obje...
Fatal asked 9/4, 2014 at 12:45

2

Solved

Given the following test code #include <iostream> #include <tr1/functional> using namespace std; struct cl { cl(){ cout << " cl()\n"; } cl(const cl& from){ cout <<...
Putupon asked 1/2, 2014 at 6:26

1

Solved

Beware: This is GCC 4.1.2. We're on a proprietary embedded platform. We cannot update to a new compiler. So C++03 + TR1 it is. We somewhere have a function like this: template<typename T> ...
Archibald asked 12/12, 2013 at 14:59

4

Solved

I am just learning about smart pointers, and I am having trouble assigning a pre-existing location of a variable to the standard library's shared pointer. For example, lets say you have an int x, ...
Decant asked 25/11, 2013 at 14:30

2

Solved

Is it possible to somehow compare two std::tr1::function<> objects? What if I have a collection of function<void(int,float)> objects and want to add and remove event handlers? Adding is...
Borderland asked 1/5, 2011 at 7:16

3

Solved

When I try to include things like <unordered_map> it fails and says the file doesn't exist, while when I try to include <tr1/unordered_map> it works. however, the include files that are...
Rawdon asked 24/10, 2011 at 2:50

1

Solved

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 sugge...
Lemniscate asked 21/2, 2013 at 22:22

3

Solved

Given: #include <functional> class world_building_gun; class tile_bounding_box; typedef std::function<void (world_building_gun, tile_bounding_box)> worldgen_function_t; void foo() { w...
Accentual asked 24/5, 2012 at 3:17

3

Solved

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 ...
Noyade asked 28/2, 2010 at 6:2

4

Solved

I have C++03 code that looks like this: #include <boost/tr1/unordered_map.hpp> ... std::tr1::unordered_map<std::string, int> mystuff; ... I started to wonder that i would suffer late...
Stepfather asked 24/5, 2012 at 10:52

2

Solved

How does one start using the tr1 features of Visual Studio 2010? For a more specific case, I require the std::tr1::function. I tried including #include <tr1/functional> which reports as missi...
Licastro asked 1/5, 2012 at 19:14

© 2022 - 2024 — McMap. All rights reserved.