c++

C++ Library or Wrapper for CouchDB

Can anyone recommend a library or a wrapper for the RESTful interface of couchDB? No need to re-invent the wheel here, I assume. Or at least a help to create any RESTful client? ...

MySql and MsSQl backup with code

I try to back up from MySQL with codes. Is it possible? If it will possible, I could use this code getting backup from MsSQL. Thank a lot. ...

How to fill std::vector with data from another vector that meets some criteria

Hi, I have a vector of points, and I need to get those which are at a distance less than a value from a given point. I could do it with a simple loop, but is there a better way to do it? Thanks in advance ...

C++ - change the cursor in an X Window

I thought this would be easy to find, but a google search has been very unhelpful. Is there a simple api to change the mouse cursor in your X window? (I know in windows you can just call "SetCursor") ...

Is there a C/C++ library that allows you to find out whether a set of expressions are mutually exclusive?

Hi, I'm writing a compiler for a dataflow programming language I have designed. One of the features that I really like about it is that you can express the following: x <- a + 1 if b > 3; x <- a - 1 if b <= 3; Which implies something like: x <- a - 1 + 2*(b>3); In order to pull this off though the compiler needs to know that: ((b >...

Rotate Text by 90 degrees with GDI+

I want to draw text to a GDI Surface and rotate this text by 90 degrees counter clockwise. I would prefer to use DrawText to draw the text because it supports carriage return. I tried to use a font with lfEscapement (see the code below) but the line is not rotated - one line gets rendered over the other. Is there any possibility to rotat...

Programming with C/C++ in Ubuntu linux

How to display beginning sector of each partition in ubuntu ?like in windows there is an API to call disk structure in c/C++ .. any suggestions will be help full. ...

Static properties in C++

With pseudo code like this: class FooBar { public: int property; static int m_static; } FooBar instance1 = new FooBar(); FooBar instance2 = new FooBar(); If I set property of instance1, it would obviously not effect the second one. However, if I set the static property instead, the change should propagate to every instance of...

Get correct QGraphicsItem

I have a custom class derived from QGraphicsItem. In that class I have private data member which is QGraphicsSvgItem. In my custom class constructor I am creating a QGraphicsSvgItem and its parent as my custom class. Below what I did. class CustomItem : public QGraphicsItem { private: QGraphicsSvgItem *svgItem; } CustomItem::C...

Boost thread error

hello, #include <boost/thread/thread.hpp> #include <iostream> void hello() { std::cout << "Hello world, I'm a thread!" << std::endl; } int main(int argc, char* argv[]) { boost::thread thrd(&hello); thrd.join(); return 0; } i ran this program i am getting an error /usr/include/boost/thread/pthread/mutex.hpp:40: und...

Friend access to protected nested class

I have the following C++ code: class A { protected: struct Nested { int x; }; }; class B: public A { friend class C; }; class C { void m1() { B::Nested n; // or A::Nested } }; Compiling this snippet with g++ 4.4, it does not make a difference whether I use B::Nested or A::Nested in m1. Clang accepts B::Nested, but...

Drawing sprites on D3D device

I have a hooked DirectX used in C++ code that draws text and sprite. I tested it and it drew well onto 2D application. However, when I tried it with 3D application (some complex game actually), only text was visible. From that I deduced the sprite is not being overdrawn by something else, hence the text would be too. I set flags Set...

Why always 6 parameters are shown for functions in a callstack generated on Solaris?

Why do the functions displayed in a callstack generated in Solaris always contain 6 parameters? In most of the cases, the original function will not be having 6 parameters at all. Sometimes I also find, the parameter values displayed are not matching the order in function declaration. Any pointers or links for understanding these conc...

Starting new job. How to get up to speed on existing design and code?

Possible Duplicate: How to understand the design and code flow of any product quickly? I am starting a new job in two weeks and would like to know of any suggestions you can provide. It's a C++ project, large team (30+), and I'll be the new guy. I know the first thing is to get the source and compile (after getting an overvi...

non-technical benefits of having string-type immutable

Hi, I am wondering about the benefits of having the string-type immutable from the programmers point-of-view. Technical benefits (on the compiler/language side) can be summarized mostly that it is easier to do optimisations if the type is immutable. Read here for a related question. Also, in a mutable string type, either you have thre...

Learning C++, questions about environment

I am asking this here because I think my last question was more than one question so creating another question seemed appropriate. However, you can close it if it does not adhere to the SO policies. In this comment on my last question , I was given a nice advice by Michael Aaron Safyan (at least I liked it): Once you feel somewhat ...

ActiveSync library

I am writing a cross-platform c++ application that needs to connect to Exchange servers and download mails using ActiveSync. Is there any library available for ActiveSync (preferably open-source)? I can't use Windows APIs as they won't run in Linux & Mac. ...

Size of struct with a single element

Given struct S { SomeType single_element_in_the_struct; }; Is it always true that sizeof(struct S) == sizeof(SomeType) Or it may be implementation dependent? ...

Weird linker error with static std::map

Why do I get linker error when I try to compile this in Visual Studio 2008 #include <stdafx.h> #include <iostream> #include <map> #include <string> class MyClass { public: MyClass () { }; virtual ~MyClass() {}; static std::string niceString (std::map<int, int> mappp) { _myMap = mappp; return "nice string"; }; private: static std:...

warning C4673: throwing 'ex::traced_error<EX>' the following types will not be considered at the catch site

MSVC 10 and MSVC 9 are both generating a level 4 warning message when compiling my exception framework, although the behavior of the program seems correct. The exception framework is rather large & complex, but I have managed to boil it down to its essence. This is a complete program you can compile & run in VS10 #include <cstdlib> #...