boost

C++ reference to a shared_ptr vs reference

All, I recently posted this question on DAL design. From that it would seem that passing a reference to an object into a function, with the function then populating that object, would be a good interface for a C++ Data Access Layer, e.g. bool DAL::loadCar(int id, Car& car) {} I'm now wondering if using a reference to a boost::shar...

A Better Boost reference?

The thing that really turns me off about Boost is their documentation. What I need is a good reference, and instead of explaining what a good reference is to me I would give example: java.sun.com/javase/6/docs/api/ Yes I love it. It is also this: cppreference.com/wiki/stl/vector/start On the other hand what I find about boost is some...

Can someone post an example of creating a boost inv_adjacency_iterator using inv_adjacency_iterator_generator?

Given definitions: typedef typename boost::graph_traits::adjacency_iterator adjacency_iter; typedef typename boost::inv_adjacency_iterator_generator::type inv_adjacency_iter; I am interested in semantics of boost::tie(i, end) = inv_adjacent_vertices((*start); adjacent_vertices works fine where inv_adjacent_vertices fails with the foll...

Using Smart Pointers with boost intrusive

I am having trouble using smart pointers in boost intrusive containers. According to the documentation the requirements for using smart pointers with intrusive containers are the following: It must support the same operations as a raw pointer, except casting. It must be convertible to a raw pointer and constructible from a raw pointer...

Examples of OpenGL programs with networking code?

Hello, I'm wondering if anyone has/knows of any examples of networking code integrated with OpenGL. Basically, I need to send position coordinates of something over a network to my OpenGL display... which would then draw the object at the correct position. The problem I'm having is integrating my UDP code with the game. I basically ...

Getting spaces with Boost::regex

I have a chunk of text like: Name=Long John Silver;Profession=cook;Hobby=Piracy And using the Boost::regex library I am trying to get the value of each attribute so I have the following regular expression for Name: regex(".*Name=([^;$]*).*") I understand it as "get everything after Name= until you find a ; or the end of line". How...

C++ char** -> vector<string> -> string -> char** parsing problem

Lets say that I'm trying to solve a parsing problem of string to char ** For some reason the below code generates a lot of trash, can anyone have a look at it please? Here's what it's supposed to do : Dump all argv into a string_array container Dump everything in the string_array container into a std::string and separate with spaces Br...

removing duplicates from a preprocessor sequence

I have a boost pre-processor sequence defined as #define MY_SEQ ((a) (b1) (b2))\ ((b) (b3) (b4) (b1)) I want to generate two enums from this as, enum alist{a,b}; and enum blist{b1,b2,b3,b4}; The code below does not remove the duplicates from blist (LIST2 macro). Is it possible to remove the duplicates from the pre-processor list...

Regular expressions question

I've got the following string : const std::string args = "cmdLine=\"-d ..\\data\\configFile.cfg\" rootDir=\"C:\\abc\\def\""; // please note the space after -d I'd like to split it into 2 substrings : std::str1 = "cmdLine=..."; and std::str2 = "rootDir=..."; using boost/algorithm/string.hpp . I figured, regular expressions would ...

High CSwitch ("context switch") when using Boost interprocess code (on Windows, Win32)

Hi, I'm writing a multithreaded app. I was using the boost::interprocess classes (version 1.36.0) Essentially, I have worker threads that need to be notified when work is available for them to do. I tried both the "semaphore" and "condition" approaches. In both cases, the CSwitch (context switch) for the worker threads seemed very h...

Is it possible to use function pointers across processes ?

I'm aware that each process creates it's own memory address space, however I was wondering, If Process A was to have a function like : int DoStuff() { return 1; } and a pointer typedef like : typedef int(DoStuff_f*)(); and a getter function like : DoStuff_f * getDoStuff() { return DoStuff; } and a magical way to communicate wit...

How to see what g++ command-lines Boost.Build invokes (1.33.1)

Hi, I'm scratching my head, trying to figure out why the import libraries are not generated when I build the Boost libraries on my machine. More specifically, building the DLLs works fine, but where I would previously (i.e. before I reinstalled my machine) generate the import libraries correctly. Some specs: Boost 1.33.1 g++ 4.3.3 TD...

How to know when to use the .a or .so when linking to Boost?

I wanted to try out the Boost::Serialization library for a project I'm working on. I'm also trying to get used to programming in Linux as well. I set up boost in its default locations. I tried compiling the test file they provide here with the command line arguments they provide and it worked fine. In this example they use the .a file. ...

Intellisense shows boost::boost::boost::boost::boost::boost::classname....... why?

I have some C++ code, and for some reason, for a couple of classes, they show up as boost::boost::boost::boost::boost::classname in the Visual Studio browser. The classes themselves are not in the boost namespace. There's no problem compiling the code. I've output the preprocessed version of the .cpp file, and I can't see anything fun...

Boost C++ date_time microsec_clock and second_clock

I discovered a strange result in Boost C++ date time library. There is inconsistency between microsec_clock and second_clock, and I don't understand why is that. I am using Windows XP 32-bits My snip of code: using namespace boost::posix_time; ... ptime now = second_clock::universal_time(); std::cout << "Current Time is: "<< to_iso_ext...

How to define (non-method) functions in header libraries

When writing a header library (like Boost), can one define free-floating (non-method) functions without (1) bloating the generated binary and (2) incurring "unused" warnings? When I define a function in a header that's included by multiple source files which in turn is linked into the same binary, the linker complains about redefinition...

How can I build the Boost.Python example on Ubuntu 9.10?

I am using Ubuntu 9.10 beta, whose repositories contain boost 1.38. I would like to build the hello-world example. I followed the instructions here (http://www.boost.org/doc/libs/1%5F40%5F0/libs/python/doc/tutorial/doc/html/python/hello.html), found the example project, and issued the "bjam" command. I have installed bjam and boost-bu...

Warning linking boost lib in WDK build ("LNK4217: locally defined symbol _ imported in function _")

I'm building the below example boost-consuming user-mode app with the WDK, but I'm getting the following errors when linking with the boost libraries that I built earlier using bootstrap and .\bjam, from the same terminal window. IIUC, MSDN says it's because the (hideously mangled) function - which appears to be a C++ std lib function -...

Boost.Python - How to return by reference?

I'm using Boost.Python to create Python modules from C++ classes. And I ran into a problem with references. Condider the following case where I have a class Foo with overloaded get methods that can either return by value or reference. Specifying that the return by value should be used was easy once I typedefed a signature. But I think ...

C++ matrix transposion. Boost uBLAS and double*?

Hello! I need to do a in-place transposition of a large matrix(so the simplest way to allocate another matrix and transpose to it won't work). Unfortunately, this large matrix isn't square. And worse, the matrix is stored in an array of doubles with number of columns and rows stored separately. I found that boost has the uBLAS library,...