c++

c++ redefine a class

Hi. I would like to redefine a class in c++ (non clr). Here's the reason class BabyClass { public: string Name; int getSiblings(MainClass &mclass) { int c = mclass.size(); for(int i=c;i>0;--i) { if(mclass.at(i).Name != Name) cout << mclas...

How to correctly parse incoming HTTP requests.

Hello all, i've created an C++ application using WinSck, which has a small (handles just a few features which i need) http server implemented. This is used to communicate with the outside world using http requests. It works, but sometimes the requests are not handled correctly, because the parsing fails. Now i'm quite sure that the requ...

Reasons for refactoring tools for C/C++ to be so limited

What is the problem that no industrial level refactoring tool for C/C++ have been created, I only need a tool that "just works"? What I mean by "industrial level" is a quality provided by JetBrains products (IntelliJ, ReSharper), or above. Any available solutions (including Visual Assist from Tomato Software or Eclipse CDT) are not matu...

Initilizing value for a const data

Following code is in my c++ class static const QString ALARM_ERROR_IMAGE ; i want to initilize ALARM_ERROR_IMAGE = "error.png"; Is it possible to initilize error.png to static const QString ALARM_ERROR_IMAGE Want to keep it inside class ...

Objective-C++ and .cpp files in Xcode

Hello, I'm trying to make a simple Objective-C++ applicaiton. All of my code is compiling fine, including the use of C++ in Objective-C classes, until I try and add a C++ class to the mix. I've created a simple C++ class: Test.h class Test { }; and included this file in a Objective-C class (with a .mm extension) and I get the fol...

How to prevent COM Server EXE to open Command Prompt window

Hi everyone, my question may be simple for you, but I have no experience about it. So, the problem is that I have a COM server and it is started from the context of another EXE, and I need to prevent this COM Server application to open a command prompt window, thanks in advance for your help. ...

Can a contiguous allocation boundary be forced in a C++ template?

Simple example: template <class P> class MyT { struct Item { public: Item() {} P *pData; Item *next; }; Item *head; public: ...adding etc.. P* operator [](int index) { See question below: } }; Can I somehow make sure that the 'Item's are allocated in such a way that I ...

Looking for Find in files that supports all formats (in c++ or java)

How does for example components like the "Total Commander " search can open every file format And search inside it ? Is there free library that offer me such feature ? Basically in the end I will like to extract texts from files be able to support all formats ( pdf,Microsoft doc ,chm …) ...

How to keep static const variable as a member of a class

Hi, I want to keep a static const variable as a member of class. Is it possible to keep and how can i initilize that variable. Some body helped by saying this QString <ClassName>::ALARM_ERROR_IMAGE = "error.png"; http://stackoverflow.com/questions/3698446/initilizing-value-for-a-const-data I tried like this in CPP class i write...

What are Google Test, Death Tests

I saw the documentation of that feature is seem pretty major since it's in Google Test overview features and detailed in: http://code.google.com/p/googletest/wiki/AdvancedGuide#Death_Tests They look like standard assert() but they're part of Google Test, so a xUnit testing framework. Therefor I wonder the real usage or advantage of usin...

can a class have virtual data members?

class Base{ public: void counter(); .... } class Dervied: public Base{ public: .... } void main() { Base *ptr=new Derived; ptr->counter(); } To identify that the base class pointer is pointing to derived class and using a derived member function, we make use of "virtual". ...

C++ thread safe doubly linked list

I need the above data structure for an application I'm writing. I wondered if there is a library that already implements it or if I have to write it myself? I don't really want to reinvent the wheel if it is not necessary. I need this structure to be able to add and remove items using multiple threads without having to lock up the who...

bjarne stroustrup about another language?

Has Bjarne Stroustrup made a comment about a language that isnt C or C++(0x)? I saw his comments about C++ CLI but i havent seen him mention anything about another language. Such as D, python, javascript, OCaml, haskel, etc. If so do you have a link? (note: omg bjarne-stroustrup has his own tag!) ...

May std::tuple_element double as a universal template argument retriever?

This question got me thinking. Sometimes it's useful to grab an actual argument from a class template specialization, if it fails to define a public typedef of the argument. In C++03 it's a sign of either bad template design, or contrary design intent, and not particularly common. But variadic templates make typedef coverage impossible, ...

C++ volatile and operator overloading

I have a class A that I overload its operator=. However it is required that I need to do something like this: volatile A x; A y; x = y; which raised an error while compiling error: no operator "=" matches these operands operand types are: volatile A = A If I removed volatile, it's compilable. Is there anyway to have this com...

What is "= delete"?

What do these two strange lines of code mean? thread_guard(thread_guard const&) = delete; thread_guard& operator=(thread_guard const&) = delete; ...

What is the fastest portable way to copy an array in C++

This question has been bothering me for some time. The possibilities I am considering are memcpy std::copy cblas_dcopy Does anyone have any clue on what the pros and cons are with these three? Other suggestions are also welcome. ...

Pull out 2 numbers from a char string?

I'm trying to write a method to set 2 variables to the numbers in a char string. The string would look something like: [-][1][ ][ ][ ][ ][2][.][0][4] Where the numbers -1 and 2.04 could be extracted. I know the method signature could look something like this: sscanf(array[i],"%d%f",&someint,&somedouble) But I'm honestly not sure ho...

Windows active code page

I have a certain library (IBM's WebSphere MQ) which I'm using, with an API that is suppose to return a remote servers character set. After some debugging, it seems as though the return value of this function call returns the active code page of my machine. I saw this by looking at the return value of the function call and the result of...

What is the official way to call a function (C/C++) in ab. every 1/100 sec on Linux?

I have an asynchronous dataflow system written in C++. In dataflow architecture, the application is a set of component instances, which are initialized at startup, then they communicate each other with pre-defined messages. There is a component type called Pulsar, which provides "clock signal message" to other components which connect to...