c++

Good library for bitsets or bitarrays

Hallo all, I'm looking for some good library, that works with bitsets or bitarrays. Anybody knows something better (or not worse in all cases) then boost::dynamic_bitset? No matter if the library is open source or commercial. In my project it is a common task to store and work with large bit masks, that contain less number of ones. So t...

Suggestions to Optimize Blocking Queue implementation

T BlockingQueue<T>::pop( ) { pthread_mutex_lock(&lock); if (list.empty( )) { pthread_cond_wait(&cond) ; } T temp = list.front( ); list.pop_front( ); pthread_mutex_unlock(&lock); return temp; } The above is the pop operation as defined for a templatized concurrent blocking qu...

Creating a spanning tree using BGL

I have a BGL graph and want to create a spanning tree using BGL. Starting from a specified vertex, I want to add the shortest edge to my graph which connects with this vertex. From there on, I want to always pick the shortest edge which connects with the graph which exists thus far. So, I want to add the constraint that every new edge ...

Memory mapped files performance - memory management when working with large data sets

I have a situation where I need to work with a number (15-30) of large (several hundreds mb) data structures. They won't fit into memory all at the same time. To make things worse, the algorithms operating on them work across all those structures, i.e. not first one, then the other etc. I need to make this as fast as possible. So I figu...

Saving map data in a 2d ORPG

I'm trying to figure out how I can best save the map data for a 2d ORPG engine I am developing, the file would contain tile data (Is it blocked, what actual graphics would it use, and various other properties). I am currently using a binary format but I think this might be a bit too limited and hard to debug, what alternatives are there...

C++ & XML: parsing XML in C++ working in Ubuntu Environment

Hi, I am working on parsing a xml file with C++ in Eclipse running under Linux Ubuntu. Is there any free library for this? Or any resource that I could start with? Thanks in advance! ...

Freeze flash movie

I have a flash movie loaded into my browser.Is there any way that i can pause it and then resume it.I tryed SuspendThread() for all the browser threads but the movie won't freeze ...

error C2872: 'range_error' : ambiguous symbol

I have already searched SO and google, I am not declaring the same variable in two places nor am I including something in a weird way..that I know of. The insert method should be working fine, it's a pre-written method(i guess that could be wrong too.. lol). This is the error I get. Error: error C2872: 'range_error' : ambiguous symbol...

Is it possible to iterate an mpl::vector at run time without instantiating the types in the vector?

Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector, but this requires a functor with a template function declared like the following: template<typename T> void operator()(T&){T::staticCall();} My problem with this is that I don't want the object T to be instantiated by for_each<>. I don't need the T parame...

Not repeating types used as template parameters

Given the code below is there a nicer way to right it that doesn't repeat typename std::iterator_traits<T>::iterator_category twice? template<class T, class T2> struct foo : bar< foo<T, T2>, typename std::conditional< std::is_same<typename std::iterator_traits<T>::iterator_category, //R...

Boost.MultiArray Beginner: How to get a 4D-Array with dynamic inner-array-sizes?

Hello, i want to store some kind of distance-matrix (2D), where each entry has some alternatives (different coordinates). So i want to access the distance for example x=1 with x_alt=3 and y=3 with y_alt=1, looking in a 4-dim multi-array with array[1][3][3][1]. The important thing to notice is the following: the 2 most inner arrays/vect...

Question regarding const qualifier and constructor

Here is simple program. If I comment constructor, I get an error Just wanted to check what is the reason for this? t.cc: In function 'int main(int, char**)': t.cc:26: error: uninitialized const 'const_test' #in...

Running a C++ Console Program in full screen

How to run a C++ Console Program in full screen ? , using VS2008 ...

C++ Colors in console [Different colors in different text ]

How to add different colors in the C++ console ? , can use a one color but is there a way to use different colors in console ? ...

How to portably write std::wstring to file?

I have a wstring declared as such: // random wstring std::wstring str = L"abcàdëefŸg€hhhhhhhµa"; The literal would be UTF-8 encoded, because my source file is. [EDIT: According to Mark Ransom this is not necessarily the case, the compiler will decide what encoding to use - let us instead assume that I read this string from a file enc...

Passing only an element of a std::vector property to a BGL algorithm

I have a graph with multiple edge weightings stored as namespace boost { enum edge_weightvector_t { edge_weightvector = 1337 }; BOOST_INSTALL_PROPERTY(edge, weightvector); } typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::property<boost::ed...

Call to VB's CreateObject method in C++

Hello, I'm trying to call Visual Basic's CreateObject method from my C++ code. In VB, I'd simply type: Dim obj As Object obj = CreateObject("WScript.Network") And that returns me the object from which I can call more methods. But how can I do that in C++? I'm following the MSDN documentation in http://msdn.microsoft.com/en-us/library/b...

C++ Book to follow K&R

Possible Duplicate: The Definitive C++ Book Guide and List I have finally got round to reading K&R, and it is by far the best (programming) book I ever expect to read. It is compact and lucid. It is nectar for my logic centre. The examples are concise, and useful. Moreover they do not contain the words 'boss' and 'employ...

How to efficiently structure a terminal application with multiple option menus in C++

I'm writing a console based program for my coursework, and am wondering how best to structure it so that it is both stable and efficient. I currently have #include <iostream> #include <cstdlib> using namespace std; int main() { int choice; do { cout << "\E[H\E[2J" // Clear the console << "Main men...

Desktop application DB

Hi, I my quest to develop a cross platform application I have decided to use C++ with the wxWidgets for the programing language. Now I am facing a dilemma on what local storage solution should I use for a for this application. Any suggestions? Note: I am thinking of using SQLite, but I plan to store images in the DB and I am not sure i...