c++

Are there any low-level languages that can be used in place of scripts?

I am a "high-level" scripting guy. All my code is Class-based PHP or JavaScript. However, I want to know if there is any form of useful interpreter projects for "low-level" compiled languages like C or C++ (strange sounding huh?). This all came about when I stumbled upon http://g-wan.com/ and was fascinated by the fact that you could se...

Releasing a boost::ptr_vector, not matching documentation

I'm using boost 1.37, and I'm trying to use a boost::ptr_vector, and transfer ownership of it so I can return it from a function. Looking at the boost documentation (http://www.boost.org/doc/libs/1_36_0/libs/ptr_container/doc/tutorial.html#new-functions) std::auto_ptr< boost::ptr_deque<animal> > get_zoo() { boost::ptr_deque<animal> ...

Code golf: c++ deque->vector

I'm coding in C++ What is the shortest function of: template<T> std::vector<T> make_copy(const deque<T>& d) { // your code here } ? ...

Simple Linked List Implementation Problem - C++

Hi, I'm a programming student in my first C++ class, and recently we covered linked lists, and we were given an assignment to implement a simple one. I have coded everything but my pop_back() function, which is supossed to return a pointer to the Node that needs to be deleted in Main(). No Node deletion is to be done in the actual funct...

Compare shared_ptr with object created on stack

I have a situation where I would like to compare an object encapsulated by a shared_ptr with the same type of object created on a stack. Currently, I'm getting the raw pointer and dereferencing it to do the comparison eg: Object A; std::shared_ptr<Object> B; // assume class Object has its comparison operators overloaded if ( *B.get() <...

Can I programatically deduce the calling convention used by a C++ dll?

Imagine you'd like to write a program that tests functions in a c++ dll file. You should enable the user to select a dll (we assume we are talking about c++ dlls). He should be able to obtain a list of all functions exported by the dll. Then, the user should be able to select a function name from the list, manually input a list of argume...

SFML Releasing Resources

I've recently started using SFML and noticed that there aren't any kinds of "FreeResource" methods provided. For example, sf::Font has a function called LoadFromFile, but no functions to release the resource. I thought this was very odd. Am I missing something? Is my only option to create an sf::Font pointer and dynamically allocate and...

Does Lazy C++ (lzz) play nice with Doxygen?

Has anyone tried embedding Doxygen comments within Lazy C++ source files? Any problems? Where do the Doxygen comments go after generating the header/source files? ...

OpenCV Image Processing -- C++ vs C vs Python

I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python. I am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support. Just from looking at the index page for the various documentation it looks like the C++ bindings might have more featur...

Is it possible to treat datatypes as an input stream?

int main(int argc, char *argv[]) { Move move; ifstream inf("eof.txt"); inf >> move; return 0; } istream& operator>> (istream &is, Move &move) { is >> move.c; // c = char c[2]; cout << move.c << endl; return is; } eof.txt has lines of 2 chars, so if it had "9r", "9r" would be stored in move's data member (I made it publi...

When/why should heapmin be used?

A customer has some memory usage requirements of our application. They note that while our committed memory is reasonable, the reserved memory is high. They suspect this is because the CRT heap grows as we allocate memory, but the CRT isn't returning pages to the OS when the memory is deallocated. We are just using built-in operator ne...

[VS - C++] Linker Errors - Unresolved external symbol

Howdy. I am working on a C++ assignment for my class. I am almost done but can't seem to figure out these errors: error LNK2001: unresolved external symbol "public: virtual void __thiscall HasQuarterState::dispense(void)const " (?dispense@HasQuarterState@@UBEXXZ) gumball.obj Gumball error LNK2001: unresolved external symbol "public: vir...

c++ singleton initialization order

I have class Foo class Bar Now, I want Foo* Foo::singleton = new Foo(); Bar* Bar::singleton = new Bar(); to both initialize before int main() is called. Furthermore, I want Foo::singleton to initialize before Bar::singleton Is there anyway I can ensure that? Thanks! ...

Rotating an image in C/C++

I need code for rotating an image in C++ which functions like imrotate function of matlab. Please suggest a good link. Or if someone can provide the code for imrotate. Or at least please explain the algorithm. Its not a homework. I need this code for my project. And we can use any external library or code. ...

static destructor

Suppose I have: void foo() { static Bar bar; } Does c++ guarantee me that Bar::Bar() is called on bar, and Bar::~Bar() is never called on bar? (Until after main exits). Thanks! ...

Update file using c

I am using fprintf command for writing on the text file, but every time when the function called its remove the previous data, I actually want to update the file so that the previous data remain. Kindly guide me how I can make it possible? ...

Can somebody explain this C++ typedef ?

I've just started working with C++ after not having worked with it for quite a while. While most of it makes sense, there are some bits that I'm finding a bit confuddling. For example, could somebody please explain what this line does: typedef bool (OptionManager::* OptionHandler)(const ABString& value); ...

Using STL algorithms (specifically std::sort) from within a templated class

I've declared a template class MyContainer as bellow, then created an instance of it of type DataType1. The DataType1 class provides a friend function "DataSpecificComparison" which is used by std::sort to compare DataType1 objects. The program compiled and sorted correctly. I then defined a class called DataType2, gave it a friend imp...

Difference between call by reference and call by value

Possible Duplicate: Difference between value parameter and reference parameter ? What is the difference between call by reference and call by value? ...

terminate called after thowing an instance of '__gnu_cxx::recursive_init'

I've googled for the error above; no use. This error comes form the following line of code: void Thread::join(void** status) { pthread_join(thread, status); } Anyone has any idea what it means? (Google brings up other ppl complainig about the error, but no explaingion of it). ...