I'm writing a program which is more or less like this :
#include <list>
list<MyClass> things;
class MyClass {
// some stuff
void remove() {
things.remove_if(THING_IS_ME);
}
};
What do I need to write instead of THING_IS_ME?
In other words, I'm using a global STL list as a collection of things. At some point, an obj...
full disclosure - this is for a homework assignment. And I normally would not ask for homework help, but here it is.
I'm asked to provide 5 examples of "overloading implicit in c++". I'm sure he is referring to operator overloading for types such as char, int, float, etc in iostream and the types themselves.
I understand explicitly o...
I have a UDP based application that is implemented using a thread pool.
Messages are pushed onto a queue and the thread pool is woken when there are things to do or messages on the queue. The thread pool processes each of the messages and hands them off to
session objects which hold some state. i.e. the UDP packets are part of a sessio...
I am currently working on learning some different aspects of WINAPI, including features introduced in windows 7.. One of those is using a GUID as identifier for a Notification icon.
As can be read on the MSDN, the GUID is bound to the executable by path, the first time the notification icon is added. This page in question promises furth...
API-level Unicode GUI Native apps in C++ for Windows / Linux / Mac OS X.
I am looking for writing a simple Unicode, GUI, Native, application, that can be run without need any non-standard library, written in C++ compiled with GNU-GCC (g++).
NOT
I don't mean one-code-source run-anywhere, but 3 (Win/Linux/Mac) code source! run-without-l...
What I need to do is open a text file with 0s and 1s to find patterns between the columns in the file.
So my first thought was to parse each column into a big array of bools, and then do the logic between the columns (now in arrays). Until I found that the size of bools is actually a byte not a bit, so i would be wasting 1/8 of memory,...
I have a simple library written in C++ which I'm creating a Python wrapper for using boost.python. Some functions take a long time to execute (over 30 seconds), and I would like to make it interruptible so that when I hit ctrl-d to trigger KeyboardInterrupt in the python interpreter, I'm somehow able to respond to that in C++.
Is there ...
I have made a c++ wrapper for an allegro bitmap. I create an AguiBitmap as a global variable for testing, then later I say,
bitmap = AguiBitmap("somepath");
after allegro has been initialized.
However, when I close the application, it crashes in the bitmap's destructor. If I do al_destroy_bitmap(0); its fine, but there cant be anyth...
I'm using the Mini-XML library to parse and XML file.
I am able to load just about every element and attribute, but I am having trouble loading a long string.
Here is the relevant part of the code:
//Load XML file into XmlO
void load(wxString filenam){
//First, convert wxString to std::string for safety (char* is transient...
i have been asked in a interview question to change the entry point of a c or c++ program from main() to any other function how is it possible?
thanx in advance.
...
I have create a thread using pthread. My worker routine is a infinite loop. What is the design pattern to terminate and clean up all the resources of the pthread when my main programme exit?
pthread_create(&thread, NULL, worker, NULL);
void* worker(void* arg){
while(true){
//do something
}
}
Thanks
...
I want to create a project file turbo c++ and link the files in this project. Although i have tried for it but i found only one option that to open a project no option to create a new project. So How to do that
Thanks in advance.
Saurabh Mehta.
...
Hi, I am trying to overload the = operator on a simple C++ class called Set that contains a dynamic array of ints. For the = operator, I first want to check for self assignment, so I wanted to compare 2 pointers to make see if they have the same memory address. Here's the code:
Set& Set::operator=(const Set& setEqual)
{
//first check fo...
so how? my app is running at 60FPS, but i want 30.
...
Is there a common way in C++ to translate an error code to a string to display it?
I saw somewhere a err2msg function, with a big switch, but is that really the best way?
...
Let's assume the following code:
#include <externalLib/bar>
/**
* Bla blubb bla.
*/
class Foo : public Bar
{
...
};
How do I tell doxygen that it should list also the members of the inherited class, even if this is an external class?
To be more precise: The external lib is (OpenSceneGraph) also documented via doxygen, but no tag f...
Hi, I would like to do some microbenchmarks, and try to do them right. Unfortunately dynamic frequency scaling makes benchmarking highly unreliable.
Is there a way to programmatically (C++, Windows) find out if dynamic frequency scaling is enabled? If, can this be disabled in a program?
Ive tried to just use a warmup phase that uses 10...
Hi,
I want to have a copy of the currently running instance.
When i change a value in the copy, original object is also affected. The copy acts as an instance.
How to avoid this? I need to create an independent copy of the calling object.
Set operator+(Set s){
Set temp = *this;
for(int i=0; s.elements[i...
By referring to article Implementing a Subject/Observer pattern with templates
template <class T>
class Observer
{
public:
Observer() {}
virtual ~Observer() {}
virtual void update(T *subject)= 0;
};
template <class T>
class Subject
{
public:
Subject() {}
virtual ~Subject() {}
void atta...
I'm using libcurl to fetch some HTML pages.
The HTML pages contain some character references like: סלקום
When I read this using libxml2 I'm getting: ׳₪׳¨׳˜׳ ׳¨
is it the ISO-8859-1 encoding?
If so, how do I convert it to UTF-8 to get the correct word.
Thanks
EDIT: I got the solution, MSalters was right...