We need ADT having search and rank features.
That is, in addition to the interface of STL map, a function 'int get_rank(key)' is required.
Standard implementation of such function requires supporting and updating an extra integer field in every node of self-balanced searching tree (e.g., in black-red tree, used in STL map/set).
But it s...
There is a possibility to compile BOOST libraries in the so-called thread-aware mode. If so you will see "...-mt..." appeared in the library name. I can't understand what it gives me and when do I need to use such mode? Does it give me any benefits?
More than that I'm really confused by having BOOST Threads library compiled in NO-thre...
How can I convert between local and UTC time (in particular, from local to UTC) using boost::date_time using a current system timezone? I know about boost::date_time::local_adjustor, but it requires a template argument which is a timezone-dependent offset.
Failing platform-independent way to do that, how would I do it specifically on Li...
I have this simple piece of code that uses boost::bind:
#include <boost/bind.hpp>
#include <utility>
#include <vector>
#include <iterator>
#include <algorithm>
int main()
{
std::vector<int> a;
std::vector<std::pair<bool,int> > b;
a.push_back(1);
a.push_back(2);
a.push_back(3);
std::transform(a.begin(), a.end()...
According to this question about the topic there is no asynchronous file io in asio anything but Windows...
So fine, does anyone know of any already written extensions to asio that do asynchronous file io on Linux?
Or does anyone know of any examples on how to extend asio to support asynchronous io to {insert-whatever-here}?
...
I'm using boost::function to enable the passing of a function to a Button constructor so it holds that function. Calling it whenever it is activated.
typedef boost::function< void() > Action;
In my TitleState I've constructed a Button like this.
m_play(
ButtonAction, // This is where I pass a function to Button's Action argume...
I know that you can use boost serialization to serialize to a text format and then push over a socket, but I'd like to serialize a class of statistics data into a binary format (both for size and encoding/decoding overhead reasons). Is it safe to use boost serialization for this?
My specific worries are:
Differences between intege...
The following code causes cl.exe to crash (MS VS2005).
I am trying to use boost bind to create a function to a calls a method of myclass:
#include "stdafx.h"
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <functional>
class myclass {
public:
void fun1() { printf("fun1()\n"); }
void fun2(int i) {...
I have a container class which uses boost::optional to hold the value. Here is the code looks like,
template<typename T>
struct traits
{
typedef T value_type;
typedef T& reference;
};
template<typename T>
struct traits<const T>
{
typedef const T value_type;
typedef const T& reference;
};
template<typename T>
struct t...
I've got a map that stores a simple struct with a key. The struct has two member functions, one is const the other not. I've managed calling the const function using std::for_each without any problems, but I've got some problems calling the non-const function.
struct MyStruct {
void someConstFunction() const;
void someFunction();
};...
Whenever I search for an algorithm for 2-Sat, I get back the algorithm for the decision form of the problem: Does there exist a legal set of values that satisfy all the clauses. However, that does not allow me to easily find a set of satisfying boolean values.
How can I efficiently find a legal set of values that will satisfy a 2-Sat in...
Hi,
I have a Qt application that I compile in release configuration, run, and then perform operation X in the program. Everything runs fine.
I then compile it in debug configuration, run without debugging (so CTRL+F5), perform operation X in the program. Everything still runs dandy fine.
But when I try to run the debug configuration w...
Hi.
I've been struggling for quite a time now.
Each time I build and install an app, after running aptitude, it wants to upgrade it even if it is on the same version.
I tried to build with apt-src and apt-build too, but no luck.
Here is my configuration :
/etc/apt/preferences
Package: *
Pin: release o=apt-build
Pin-Priority: 510
Ev...
I'm trying to setup Boost 1.42 in our system. I need Boost to compile for the regular x86 architecture with gcc and I need cross compilation for an ARM processor of Texas Instruments.
The toolchain for the ARM processor is based on gcc. The tools like gcc, ar, ranlib are all prefixed with arm_v5t_le-. The documentation about cross comp...
I have a program that I need to be able to search a file with regex epressions and delete what regex has found. Here is the code I have been working on:
#include <boost/regex.hpp>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include "time.h"
using namespace std;
class application{
private:
//Variables
...
According to Boost download instructions for Linux http://www.boost.org/doc/libs/1_42_0/more/getting_started/unix-variants.html I should extract the Boost library to some directory on my computer. I am working with Ubuntu, Eclipse and CDT.
What is right directory to install Boost? Somewhere in /usr or in my home directory?
...
Is there a version of 64-bit Boost library for VS2008 ?
Or do I have to compile one myself? if, so, does anyone have experience with it?
...
Hi,
I am currently trying to fix a few weaknesses in our code base by introducing the use of smart pointers. The code base is very large, and interlinked like a spider who's had one to many coffee's.
I was wondering if people had tried the before and what their approach was.
My first step has been to typedef classes, as follows.
#ifn...
I am using the Boost library in Linux, GCC. After installing and building the Boost, I found that programs using Regex and Thread use shared Boost libraries. For my purposes, I need static linking.
How can I change linking type? Should I rebuild the Boost, or maybe I can set linking type by defining some constant in my own projects or B...
Basically I'm doing the following:
std::set<int> indices;
// ..fill indices
if (flag)
{
// we need to process in ascending order
BOOST_FOREACH (int i, indices)
{
process(i);
}
}
else
{
// we need to process in descending order
BOOST_REVERSE_FOREACH (int i, indices)
{
process(i);
}
}
I wonder if ...