c++

Makefile generator for c++?

Do the following build systems: cmake, jam and bjam also generate makefiles like qmake does? What utility does MS visual c++ uses to generate make file? ...

Ambiguous overload on template operators

I am working on two wrapper classes that define real and complex data types. Each class defines overloaded constructors, as well as the four arithmetic operators +,-,*,/ and five assignment operators =,+= etc. In order to avoid repeating code, I was thinking of using template functions when the left- and right-hand-side arguments of an o...

Video mixer filter

I need to find a video filter in order to mix multiple video streams (let's say, maximum 4). I've found a video mixer filter from MediaLooks and is ok, but the problem is that i'm trying to use it in a school project (for the entire semester) and so the 30 days trial is kind of unacceptable. So my question to you is that: are you aware ...

C++ error: cannot declare field to be of abstract type

This is the situation: class Base { virtual void methodA() = 0; virtual void methodB() = 0; }; class Base_A : public Base { void methodA(); void methodB(); }; class Base_B : public Base { void methodA(); void methodB(); }; class MyClass { private: Base * b; }; When I compile...

how to use boost::any_cast (c++ library) to cast to base types?

Hello, I am using boost::any to have polymorphic types, I need to be able to cast an object to its base type. class A { public: int x; virtual int foo()= 0; }; class B : public A { public: int foo() { return x + 1; } }; int main() { B* bb = new B(); boost::any any = bb; bb->x = 44; A...

Is there C++ library to create strong Enums ?

Ideally I would like a following examples to work, but I guess some of it is not implementable in C++. { typedef StrongEnum<Red=0, Green=1, Blue=2> Color; // not a C++ syntax Color c = Color::Red; // static const Color d; //error: default constructor is private Color d = c; Color e = Color::OfInt(5); // ifdef DEBUG - Runti...

How to create nested Lua tables using the C API

I want to create a table like myTable = { [0] = { ["a"] = 4, ["b"] = 2 }, [1] = { ["a"] = 13, ["b"] = 37 } } using the C API? My current approach is lua_createtable(L, 0, 2); int c = lua_gettop(L); lua_pushstring(L, "a"); lua_pushnumber(L, 4); lua_settable(L, c); lua_pushstring(L, "b"); lua_pushnumber(L, 2); lua_settable(L, ...

change a keystroke passing a hook(c/c++)

hello! is it possible to edit a keystroke using a winapi keyboard hook? well, not neccesary a keyboard hook but something like it.. i wanna do something like this: user presses key 'A' my function adds 1 to the virtual keycode (just an example) the 'A' becomes an 'B' and the 'B' is sent to the destination application thanks! ...

C++ template specialization with <int&> not picking up an int

Hi, I have the following code: template <typename T> LuaCall& operator>>(T) { BOOST_STATIC_ASSERT(sizeof(T) == 0); } template <> LuaCall& operator>><int&>(int& val) { mResults.push_back(std::make_pair(LUA_RESULT_INTEGER, (void *)&val)); return *this; } template <> LuaCall& operator>><float&>(float& val) { mResults.push_back(std::make_pa...

Is using underscore suffix for members beneficial?

class C { private: int member_; // here is the underscore I refer to. } This underscore is recommended by Google Style Guide and Geosoft's C++ Style Guide. I understand that there are different opinions and tastes. I want to ask people who used it or were forced to use it whether they found it beneficial, neutral or harmful for th...

Are there good examples of good C++ I/O usage.

I am heavily involved in doing I/O in C++ (currently using it for printing headers, tables, some data alignments), and wonder about it proper/great usage in either open source projects or general examples/nippets I use things such: cout.setf(ios::right,ios::jyustified); cout<<std::setw() std::copy (vector.begin(), vector.end(), std::o...

compiler error help

I am using Borland C++ Builder 6. I have installed LMD Tool version 7, and ABC for Delphi 6 companion version (runtime pakage only). When I compiled a software unit, I received the following error messages: [C++ Error] iss_hmi_gui_cached.h(58): E2209 Unable to open include file 'abcbtn.hpp' Full parser context C++ Error] iss_hmi_gui_...

Increasing memory usage in sqlite3 ?

I've written a console app which receives events via boost::interprocess memory and dumps the info into an sqlite3 database. While running the app I've noticed that, in the Windows task manager, the memory usage was cyclically increasing every... 30s-1min. This led me to believe that the problem lies within the main loop in which I execu...

Using the same header files as those in static library

If a header file (.h) included in the source file has also been included in a static library (.lib), what will happen? ...

boost spirit 2.x: how to deal with keywords and identifiers?

good day. i've been using boost spirit classic in the past and now i'm trying to stick to the newer one, boost spirit 2.x. could someone be so kind to point me in how to deal with keywords? say, i want to distinguish between "foo" and "int" where "foo" is identifier and "int" is just a keyword. i want to protect my grammar from incorrec...

Find "edges" in 32 bits word bitpattern

Im trying to find the most efficient algorithm to count "edges" in a bit-pattern. An edge meaning a change from 0 to 1 or 1 to 0. I am sampling each bit every 250 us and shifting it into a 32 bit unsigned variable. This is my algorithm so far void CountEdges(void) { uint_least32_t feedback_samples_copy = feedback_samples; sign...

PocketPC c++ windows message processing recursion problem

Hello, I am having a problem in a large scale application that seems related to windows messaging on the Pocket PC. What I have is a PocketPC application written in c++. It has only one standard message loop. while (GetMessage (&msg, NULL, 0, 0)) { { TranslateMessage (&msg); DispatchMessage (&msg); } } We also have ...

Read numbers and Convert them into doubles?

Okay, so i have a fairly annoying problem, one of the applications we use hdp, dumps HDF values to a text file. So basically we have a text file consisting of this: -8684 -8683 -8681 -8680 -8678 -8676 -8674 -8672 -8670 -8668 -8666 -8664 -8662 -8660 -8657 -8655 -8653 -8650 <trim... 62,000 more rows> Each of these represent a double:...

C++ template recursion - how to solve ?

Im stuck again with templates. say, i want to implement a guicell - system. each guicell can contain a number of child-guicells. so far, so tree-structure. in std-c++ i would go for sthg. like: template <typename T> class tree { public: void add (T *o) { _m_children.push_back (o); } void remove (T *o) { ... }; list<T*>...

Is libssl version 0.9.8e compatible with 0.9.7a?

I'm using a third party static library in my C++ project that has a dependency on libssl version 0.9.7a. Due to various reasons, the libssl version that my project used is 0.9.8e. Everything was working fine, until the third party made a recent change to their static library. I wasn't able to successfully compile my application when it ...