I would like to create a construct similar to std::iterator_traits::value_type that can work seamlessly for all types using the same syntax. Imagine we have the following:
template <typename T>
struct value_type {
typedef T type;
};
#define VALUE_TYPE(T) typename value_type<T >::type
This will work for POD types. I can specialize...
I have been building a game in allegro 4.2.1 and need help to remove a specific color to make invisible. The background color is, (255, 0, 255). I have been at the following sites, but they have not helped me much:
http://www.allegro.cc/forums/thread/599210,
http://www.cpp-home.com/tutorials/258_1.htm
If someone could provide me with a...
According to the LSB scanner, my binary is supposedly incompatible with a specific version of Linux because it uses GBLICXX_3.4.9 symbols. But when I tried to run the binary myself on that version, everything seems to work fine...
Can a binary even start on a Linux distro if that distro is missing the runtime libraries containing the r...
I would like to get an istream_iterator-style iterator that returns each line of the file as a string rather than each word. Is this possible?
...
I am using QSettings to try and figure out if an INI is valid.(using status() to check) I made a purposefully invalid INI file and loaded it in. The first time the code is called, it returns invalid, but every time after that, it returns valid. Is this a bug in my code?
...
Hello,
I would like to use a C++ class in an objective c application.
How to achieve this?
Thanks for your helps :)
...
I can't seem to figure out why this falls into a loop after getting non-int input. I've tried cin.flush(), which doesn't seem to exist, cin.clear(), which seems like it should work, even cin.sync() after reading someone else post about it working, but didn't seem to make much sense. Also tried cin.bad().
Thank you very much for any help...
I'm trying to implement an iterative version of Tarjan's strongly connected components (SCCs), reproduced here for your convenience (source: http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm).
Input: Graph G = (V, E)
index = 0 // DFS node number counter
S = empty ...
I'm working on a Command Line app to help me on launchd tasks to know if a task is running by returning a BOOL, the problem comes when i need to do a command line and obtain the output for further parsing.
i'm coding it in C/C++ so i can't use NSTask for it, any ideas on how to achieve the goal?
The Command
sudo launchctl list -x [job...
I am using the lua C-API to read in configuration data that is stored in a lua file.
I've got a nice little table in the file and I've written a query C-function that parses out a specific field in the table. (yay it works!)
It works by calling a few of these kinds of functions over and over:
...
lua_getglobal (...);
lua_pushintege...
I need to put some 3D images into PDF files, and PDF uses Universal 3D (U3D) formats. I don't like the U3D Sourceforge project (basically what Intel released after the ECMA standardization effort).
Does anybody know of good U3D libraries I could use? I'm using C++ on Microsoft Windows, FWIW.
...
Are there any tools that can transform C++ code to xml, or some other format that would be easier to parse?
It would be great if it would also have the option of turning xml back to C++ . I already know of doxygen's xml format ... maybe it's just me, but I don't find it particularly helpful.
...
Say I have some structs like this:
struct A{
int someInt;
}
struct B : public A{
int someInt;
int someOtherInt;
}
And a class:
class C{
A *someAs;
void myFunc(A *someMoreAs){
delete [] someMoreAs;
}
}
would this cause a problem:
B *b=new B[10];
C c;
c.myFunc(b);
Because it's deleting b, thinking that it's of type A, whi...
The MFC has all class names that start with C. For example, CFile and CGdiObject. Has anyone seen it used elsewhere? Is there an official naming convention guide from Microsoft that recommends this style? Did the idea originate with MFC or was it some other project?
...
Say I have these structs:
struct Base{
...
}
struct Derived:public Base{
//everything Base contains and some more
}
I have a function in which I want to duplicate an array of these and then alter it.
void doStuff(Base *data, unsigned int numItems){
Base *newdata = new Base[numItems];
memcpy(newdata, data, numItems*sizeof(Base));...
I have a C++ codebase, and I am porting from Visual Studio to g++, which should I set in Visual Studio so that build errors in gcc are reduced? With g++ this is achieved by -ansi -pedantic.
...
Hi all,
I received a code that is not for multi-threaded app, now I have to modify the code to support for multi-threaded.
I have a Singleton class(MyCenterSigltonClass) that based on instruction in:
http://en.wikipedia.org/wiki/Singleton_pattern
I made it thread-safe
Now I see inside the class that contains 10-12 members, some with g...
I have the following C formula
bucket = (hash - _min) * ((_capacity-1) / range());
What I need to to rearrange the equation to return the _capacity instead of bucket (I have all other variables apart from _capacity). e.g.
96 = (926234929-805306368) * (( x -1) /1249540730)
836 = (1852139639-805306368) * ((x -1) /1249540730)
As you c...
Curious things with g++ (maybe also with other compilers?):
struct Object {
Object() { std::cout << "hey "; }
~Object() { std::cout << "hoy!" << std::endl; }
};
int main(int argc, char* argv[])
{
{
Object myObjectOnTheStack();
}
std::cout << "===========" << std::endl;
{
...
hi
I am looking for code beautifier for UNIX/emacs. I have looked at gnu indent, artistic style, however I need something a bit different. For example, I would like the following:
for( int x= 0;; ++ x) if(x) break; to be formatted as for (int x = 0; ; ++x) if (x) break;. As far as I can tell artistic style does not do that (correc...