tr1 Questions
1
Solved
Test.h
#ifndef TEST_H
#define TEST_H
#include <memory>
template <class Type>
bool operator==(const std::weak_ptr<Type>& wp1, const std::weak_ptr<Type>& wp2)
{
std...
2
I thought that $ indicates the end of string. However, the following piece of code gives "testbbbccc" as a result, which is quite astonishing to me... This means that $ actually matches end of line...
1
While I have std::tr1::shared_ptr<T> available in my compiler, I don't
have make_shared.
Can someone point me to a proper implementation of make_shared? I see
that I need to use varargs to p...
Interstitial asked 3/2, 2012 at 20:34
6
Solved
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 k...
3
Solved
I have a project which I would like to make more use of smart pointers. Overall, I have been successful in this goal. However, I've come across one things which I'm not sure what the "best practice...
1
Solved
I read through n1429 with the section
The algorithms regex_match and regex_search both support a feature not commonly seen in regular expression libraries: a partial match. When the flag std::re...
3
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 q...
Exhalation asked 17/8, 2011 at 15:37
7
I've been trying to implement a C#-like event system in C++ with the tr1 function templates used to store a function that handles the event.
I created a vector so that multiple listeners can be a...
1
As a follow-up to Can tr1::function swallow return values?, how can one work around the limitation that tr1::function cannot swallow return values?
This should work in the specific case of swallow...
1
Solved
The boost::function FAQ item 3 specifically addresses the scenario I am interested in:
Why are there workarounds for void
returns? C++ allows them! Void returns
are permitted by the C++ standa...
Vasiliu asked 8/7, 2011 at 17:59
1
Solved
In Perl, I can do this:
$text = '1747239';
@matches = ($text =~ m/(\d)/g);
# @matches now contains ('1', '7', '4', '7', '2', '3', '9')
Using C++ regex matching, what's the best way to replicate ...
3
Solved
I'm currently looking for a better alternative to std::map and have come across classes mentioned in the post title. Could someone clarify the differences between them, not in terms of performance/...
Bautista asked 22/12, 2010 at 16:34
4
Solved
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 <tr1/memory>
std::tr1::shared_ptr<in...
Wrestle asked 10/5, 2011 at 15:34
4
Solved
How do I allow the STL implementation to pick up my custom types? On MSVC, there is a class std::tr1::hash, which I can partially specialize by using
namespace std
{
namespace tr1
{
template...
5
Solved
We are programming a logging library that keeps itself in a .hpp file. We would like to include <tr1/unordered_map> (if the compiler supports TR1,) or the standard <map> otherwise. Is t...
Lyndel asked 7/4, 2009 at 7:19
3
Between C++0x, C++03 TR1 and boost some things like function and bind can be defined in 3 different places depending on the compiler, eg for VC pre VC9 feature pack you have the boost versions, the...
2
Solved
I'm using the latest available GCC build from repository. I decided to use it because some additional C++0x features. However now I stuck with something what supposes to work - I want to add new el...
4
Solved
I initially thought they're all the same, but it turned out to be wrong. So can anyone briefly explain the differences between these three? For example:
std::bind ( newest one, next generation of...
1
Solved
What is the current support for tr1 or the new C++0x on the Mac
I know that the gcc supplied with XCode is always a couple of versions behind that available from gcc.gnu.org so I was just wonderin...
4
Solved
I'm trying to use the C++ STD TechnicalReport1 extensions to generate numbers following a normal distribution, but this code (adapted from this article):
mt19937 eng;
eng.seed(SEED);
normal_dist...
Undertone asked 13/7, 2009 at 9:33
1
Solved
Boost::Serialization has builtin support for boost::shared_ptr<>.
Is there a way to use this support for std::tr1::shared_ptr<> too?
Is it possible to cast from std::tr1::shared_ptr<...
Susannahsusanne asked 4/11, 2010 at 7:21
2
#include <string>
#include <tr1/regex>
#include "TextProcessing.h"
const std::string URL_PATTERN("((http://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)");
const std::string REPLACEMENT("<a h...
1
Solved
Are there any difference between tr1::shared_ptr and boost::shared_ptr? If so, what?
Hanfurd asked 30/9, 2010 at 14:31
3
Solved
I'm currently writing a C++ memory editing library and for the read/write APIs I use type traits (std::is_pod, std::is_same) and boost::enable_if to provide 3 overloads:
POD types. e.g. MyMem.Rea...
1
Solved
Let's say you have a c++0x std::array member of a template class and you want to initialize it by means of a constructor that takes a couple of iterators:
template <typename Tp, size_t N&...
© 2022 - 2024 — McMap. All rights reserved.