c++

Where can I find an efficient R-Tree implementation?

I'm looking for an R-Tree implementation, in C, Objective-c and even C++, which shall be efficient for searching the 2d rectangle in which a point falls ( memory efficiency would also be great, but I can sacrifice a bit more memory for time even while I am on an iPhone ). A good documentation will be appreciated too ...

Count of parameters in a parameter pack? Is there a C++0x std lib function for this?

I was just wondering if there was anything in the C++0x std lib already available to count the number of parameters in a parameter pack? I'd like to get rid of the field_count in the code below. I know I can build my own counter, but it just seems like this would be an obvious thing to include in the C++0x std lib, and I wanted to be s...

How do I check what version of java im using in c++

I have a testing script that checks what version of java the user is using and then executes some commands. But we are trying to convert all of our testing into cxxtests. I would like to know how to convert my version checking script into c++ code. I know I could just use the system() command but I would like that to be a last resort....

Problem with my makefile

I have this Makefile and each line run OK separately, but when I do make I get this error: make: *** No rule to make target `CoalitionManipulation‬‬.cpp', needed by `CoalitionManipulation‬‬.o'. Stop. But I can see the CoalitionManipulation.o file, it means it exists! Bere is the makefile: CoalitionManipulation‬‬ : ‫‪CoalitionManipul...

How can I compile C++ code using another C++ program?

I want to create a program that modifies another c++ source,compiles it and runs the exe. I mean with something like gcc may be I can but on a windows os gcc may not be present. Is it possible? ...

Should C++ 'interfaces' have a virtual destructor

Possible Duplicate: Destructors for C++ Interface-like classes Consider a simple example of a C++ abstract class, used to model an interface: class IAnimal { virtual void walk()=0; virtual ~IAnimal(){} }; Is it better to have the destructor, or not? I don't think the destructor can be pure virtual, at least my tests giv...

c++ class declaration error ??

hello guys i am new to c++ i am trying to create an class these are my files //main.cpp #include <iostream> #include "testing/test.h" #include <string> using namespace std; int main(void) { test c; c.set_url("e"); } test.h #ifndef TEST_H_ #define TEST_H_ #include<string> class test { public: void testing(string url); ...

std::vector optimization

Assuming a loop that reads a lot of values from an std::vector is a bottleneck in my program, it has been suggested I change void f(std::vector<int> v) { ... while (...) { ... int x = v[i] + v[j] ... } } to void f(std::vector<int> v) { int* p_v = &v[0]; ... while (...) { ...

List All Open Files

This is an add-on to another question found here. In short: I would like to list all of the open files on a system and retrieve their associated file names. If this is the wrong approach, or if there's another way, please give me a push in the right direction. Or, if I'm missing any details or something's unclear, please yell at me. ...

iterator for map

hello i am trying to make a map containing objects as the following : class Employee >>dervied from Employee : are the following classes : Worker , Manager and ViceManage. in my map i want to have the object Employee sorted by his ID which is char* i tried to create a map like this:` multimap<const string,Employee*> t1 t1<string,Employe...

Error after compiling .IDL file for Firefox accessibility

Hello everyone! I've encountered a very annoying problem while working with Firefox MSAA (). I tried to compile IDL file from cmd but it failed. Then I added it to the project and ran build. After VS compiled interface file there were two C files - ISimpleDOMDocument_h.h and ISimpleDOMDocument_i.c I added those to the project. But now I...

Do Strong Types prevent Buffer Overflow?

Do strong types, in this case char prevent buffer overflow? char a[100] char b[100] strcpy(a,unknownFunction); // unknownFunction could overflow b // since its length is unknown strcpy(b,a); // can b still overflow a with its now, // potentially overflowed size? ...

Writing an class/struct that changes frequently

Summary: I have a struct that is read/written to file. This struct changes frequently, and this causes my read() function to get complex. I need to find a good way to handle change while keeping the bug count low. Optimally, code should be make it easy for one to spot the changes between versions. I have thought through a couple of pa...

What makes this code "endian independent"?

I came across the following code, and was told that it means that COL_8888_RED is "endian independent". Why? What makes this endian independent? (I have asked the original coder but they're not getting back to me ... heck maybe they don't know either.) union _colours { uint8 c[3][4]; uint32 alignment; }; static const union _co...

c++ sizeof( ... )

#include <cstdlib> #include <iostream> int main(int argc, char *argv[]) { cout << "size of String " << sizeof(string ); system("PAUSE"); return EXIT_SUCCESS; } Output: size of String = 4 Does that mean that, since sizeof(char) = 1 Byte (0 to 255), string can only hold 4 chara...

Try-Catch Block For C++ File-IO Errors Not Working

I'm very new to the world of C++ error handling, but I was told here: http://stackoverflow.com/questions/3622030/checking-for-file-existence-in-c ...that the best way to checks for file existence was with a try-catch block. From my limited knowledge on the topic, this sounds like sound advice. I located this snippet of code: http://ww...

linkage .a in eclipse

hi i am using eclipse ide for c++ and i have file.a and i want to do linkage to this file how i do this? ...

boost.serialization and replace existing method of serializing std::wstring

Hi! I need to serialize std::wstring by my own method. How to force boost to use my methods of serialization instead of default methods? Thanks. ...

Dynamic C++ Objects Array Declaration

I want to make a dynamic array of foo, with the number of items being x. Arguments y and z are to be passed to the constructor of the item foo. I was hoping to do something similar to: foo *bar; bar = new foo(y,z)[x]; However that produced the following compiler error: error: expected `;' before '[' token So after speaking with a...

boost shared_from_this<>()

Hello all, could someone summarize in a few succinct words how the boost shared_from_this<>() smart pointer should be used, particularly from the perspective of registering handlers in the io_service using the bind function. EDIT: Some of the responses have asked for more context. Basically, I'm looking for "gotchas", counter-intuitive ...