Can I implement multiple callback interfaces in C++?
Can I implement multiple callback interfaces in C++ for Java? ...
Can I implement multiple callback interfaces in C++ for Java? ...
I just had some weird behavior from a version of g++ for Windows that I got with Strawberry Perl. It allowed me to omit a return statement. I have a member function that returns a structure consisting of two pointers, called a boundTag: struct boundTag Box::getBound(int side) { struct boundTag retBoundTag; retBoundTag.box = thi...
I want add a logger function to a worker class, how to pass a member function as a function pointer? use mem_fun? here is the code sample: class Work{ public: void (*logger) (const string &s); void do_sth(){if (logger) logger("on log")}; }; classs P{ public: void log(const string &s)(cout << s); }; int main(){ Work w;...
I have a few questions regarding differentiation between const and non-const versions of methods in C++. Example: MyObject* MyClass::objectReference() const MyObject* MyClass::objectReference() const My questions are: Is there any way at all to differentiate between which version of the method is called manually? Or is it ful...
To add const to a non-const object, which is the prefered method? const_cast<T> or static_cast<T>. In a recent question, someone mentioned that they prefer to use static_cast, but I would have thought that const_cast would make the intention of the code more clear. So what is the argument for using static_cast to make a variable const? ...
template <typename T> void function(T arg1, T min = std::numeric_limits<T>::min(), T max = std::numeric_limits<T>::max()) { } template <> void function<int>(int arg1, int min,int max) { } int main(int argc,char* argv[]) { function<int>(1); } it give syntax error C2689 and C2059 on function default argument line on :: tok...
I want to get the IP address of the socket that's connected to my server socket. I've included my code. The sa_data doesn't return char[14] of the type "xxx.xxx.xxx.xxx". Instead, it returns [11][1][xxx][xxx][xxx][xxx][][][][][][][]...[]. Can anyone help? int InitialResult; char SendMessage[1024]; char ReceiveMessage[1024]; WSADATA ...
Hi, I am a beginner to C++. Can some one tell me a best data structure in C++ to store all words in a dictionary and find if a word is present in the dictionary. I know hash tables are the best but I dont know which data structure uses them ? Thank you very much in advance. ...
I was thinking about some memory pool/allocation stuff I might write so I came up with this operator new overload that I want to use to facilitate reuse of memory. I'm wondering if there are any problems you guys can think of with my implementation (or any other possible ones). #include <cstddef> namespace ns { struct renew_t { }; ...
The C++ Standard in 14.2/2 says: For a template-name to be explicitly qualified by the template arguments, the name must be known to refer to a template. Can any one Tell this one to prove in terms of programming? ...
I send the url to find the page what I need. Hovewer there is a misunderstanding with google. QString baseurl("http://blogsearch.google.com/blogsearch?hl=tr&ie=UTF-8&q=C++"); I send searched string q=C++; but google search the string only C, it does not search C++. What to do for change the searching key C to C++ ? ...
I want to know how the "isupper" macro is defined in C/C++. Could you please provide me the same or point me to available resources. I tried looking at ctype.h but couldnt figure it out. ...
So it's been a while since I've used straight C. And I'm on a project where I'm working on an API in C++. Most of these methods are just C anyway, and all of the return values are C structures. Except one. One method I need to return a vector<string>. Now here's my question. Is C++ methods/libraries/whatever callable from C? I ask becaus...
Hi All ! I am still a C++ newbie. Just came to read that the static member function of a class is not object specific - there is a single copy of the member functions for all the objects. Now two questions arise in my mind : What is the difference between an ordinary function and a static function "in terms of memory allocation only"...
Hi all, Here's my dilemma: I have to RGBA RAW images: a master image (the first) and a subtitle track (the second), and I want to overlay them in a way based on the alpha channel of the second image: If it's zero, then take the pixels from the second image, if it's 0xFF take the pixels from the first image, otherwise create an overlay o...
I have to implement small multimage graphic control, which in essence is an array of 9 images, shown one by one. The final goal is to act as minislider. Now, this graphic control is going to receive various integer ranges: from 5 to 25 or from 0 to 7 or from -9 to 9. If I am going to use proportion - "rule of three" I am afraid is no...
I have a int var; and using cin, but how to check if user input a float or give me a solution for this problem? ...
In .NET you have the handy System.Net.CredentialCache.DefaultCredentials to set all your needed proxy data to the default values of the system. How can i do something similar in native C++? I need the proxy address, username and password. Our project uses MFC and cURL ...
hi, Is there an inbuilt function to convert C++ string from upper case letters to lowercase letters ? If not converting it to cstring and using tolower on each char is the only option ? Thank you very much in advance. ...
Hi, I have a cpp class like that.. class MyContactListener : public b2ContactListener { int countContact; ///this is an objective c class... HelloWorld *hel; public: void EndContact(b2Contact* contact) { ///initialize objective c object hel=[[HelloWorld alloc] autorelease]; ...