Implementing the copy constructor in terms of operator=
If the operator= is properly defined, is it OK to use the following as copy constructor? MyClass::MyClass(MyClass const &_copy) { *this = _copy; } ...
If the operator= is properly defined, is it OK to use the following as copy constructor? MyClass::MyClass(MyClass const &_copy) { *this = _copy; } ...
can i use Symbolic C++ features in linux c++ compiler or in visual c++ 2010? and also one question sometimes in programs there is such headers code #include <iostream> #include "symbolicc++.h" using namespace std; int main(void) { Symbolic x("x"); cout << integrate(x+1, x); // => 1/2*x^(2)+x Symbolic y("y"); cout << df...
Hi, just a quick question. C++ allows main function to have return type void. But doesent OS require int type value returned to specify wheather program ended well or not? Thanks. ...
Hello. I am new to C++. Before, when working with Java, I could make an executable as either a jar or exe file. Is it is possible in C++ for any other format? I need an format that works on Linux. I am using Eclipse as development IDE - is there any built in way to export as an executable file? ...
I have to develop an application for windows that will enable controlling the mouse through web cam by recognizing hand gestures. I will be using vc++ 2008 for development. But I am confused whether to go with .NET framework or core win32 APIs. Performance is very important for my application. As per the book "Beginning Visual C++ 2008" ...
i was told that to redirect from standard input to file i need to do the following: static std::ifstream inF("inpur.txt"); std::cin.rdbuf(inF.rdbuf()); and every call to std::cin will be redirected to input.txt. but my question is: do i need to open inF? and if i do, where do i need to do this? ...
Hi, I'm writing this library that implements some basic audio player features in C++/CLI via the Media Foundation framework that will be consumed by managed code. I can play audio, stop, pause, etc just fine. For anyone who is not familiar with Media Foundation, the media session posts events that you can handle for notifications. Th...
Hi, I am familiar with QT/gtk+ libs under linux. I've just roughly had a look at available c++ frameworks like Reason and Platinum. Does anyone have any experience working with any of them? Are they any good, should I consider learning them? I am not a big fan of frameworks though. ...
Given a class A, class A { public: A(B&) {} }; I need a boost::function<boost::shared_ptr<A>(B&)> object. I prefer not to create an ad-hoc function boost::shared_ptr<A> foo(B& b) { return boost::shared_ptr<A>(new A(b)); } to solve my problem, and I'm trying to solve it binding lambda::new_ptr. boost::function<boost::shared_p...
hello, i am writting an small crawler that extract some 5 to 10 sites while getting the links i am getting some urls like this ../tets/index.html if it is /test/index.html we can add with base url http://www.example.com/test/index.html what can i do for this kind of urls. ...
I have a dialogue which contains a drawing area. I wish to redraw the contents of the drawing area if the dialogue is enlarged or shrunk or buried and exposed, as is normal and natural with drawing areas. To this end, I created a method bool on_expose_event (GdkEventExpose *event); in the class. But the presence of this event stops a...
Suppose someone wrote a method that opens a certain file and forgets to close it in some cases. Given this method, can I make sure that the file is closed without changing the code of the original method? The only option I see is to write a method that wraps the original method, but this is only possible if the file is defined outside t...
Hi, Ours is a huge project. I need to call certain functions in my code asynchronously to avoid some circular function calls. Upon receiving a specific input, I can call my function asynchronously either by using Event or Timer. Which way is preferable considering Performance ? Sending events to Event manager and handling them with an ...
I try to implement a template class which requires to have a signal member that depends on the template argument. My first idea was to realize it like the following: template<class T> class SignalClass { typedef boost::signals2::signal<void (T &)> OnReceive; public: SignalClass(const OnReceive::slot_type &_slot) { m...
I am having an issue with 2 classes that were once nicely separated, but now they want to couple. Without getting too much into the specifics of the problem, here it is: I used to have a class Triangle that contained 3 space-position vertices. class Triangle { Vertex a,b,c ; // vertices a, b and c } ; There were many Triangle in...
I use MSVS 2010 and MSVC++E 2010 to build my applications in C++ and I've notice a lot of my friends (who test my apps on their PCs) don't have the Microsoft C++ runtime library installed on their computers. I've started including the Microsoft C++ redistributable package with my apps, but this seems unnecessary. Would I be able to inste...
I'm making a game where the player is an upright capped cylinder, and the world is axis aligned bounding boxes. Given this, how could I check if the cylinder is intersecting a box? Thanks ...
I have recently stumbled upon the CipherSaber project, and thought it would be fun to implement the CS1 algorithm, an RC4 with IV. On encryption it generates a random 10 byte IV, it appens it to the password and then crypts. On generation the IV is read from the beginning of the file (first 10 bytes) and then appended to the password and...
if i want to have 3 classes, which have common fields (and i want them to be static) and they have a common function (which needed to be overridden, i.e virtual) what the best design to do this? do i need to create an interface in a header file and then create it's .cpp file and get the 3 classes inheritance from it? what about the sta...
I would like to return a noncopyable object of type Foo from a function. This is basically a helper object which the caller will use to perform a set of actions, with a destructor to perform some cleanup after the actions are complete. Before the advent of rvalue references, I would have returned a shared_ptr<Foo> or something similar. ...