Hi all,
I've got a lightweight templated class that contains a couple of member objects that are very rarely used, and so I'd like to avoid calling their constructors and destructors except in the rare cases when I actually use them.
To do that, I "declare" them in my class like this:
template <class K, class V> class MyClass
{
publi...
A while back, I got a Lego NXT for Christmas, and now I would like to program it in C++.
I have looked around, here and other places, and could not find a cross-platform, open source, OOP C++ library that "felt right", including lestat and nxtOSEK.
So, I have decided that unless I can find one I do like, then it would be a great learni...
I there a compiler option I could use in CC compiler to get the following code
(which compiles fine in Visual C++)
std::vector<std::vector<double>> v2;
without the following error
Error: "," expected instead of ">>"
...
I'm trying to port an old program I wrote for class from KDev in Ubuntu to Windows Visual Studio 2008 using Cygwin as a personal learning exercise. I have the include path configured to include C:\cygwin\usr\include but it doesn't read the .h files properly.
Namely I'm curious as to how one would go about using unix sockets.h functional...
I'm making a game where the game's size varies, so I want to make my own shadows. The api i'm using can fill rectangles, make ellipses, horizontal lines etc. And supports rgba. Given this, how could I make a drop shadow? I tried making a black to white gradient and setting the alpha to 20%, but it didnt look very good... I'm not sure how...
Bjarne Stroustrup writes:
"a friend class must be previously declared in an enclosing scope or defined in the non-class scope immediately enclosing the class that is declaring it a friend"
Isn't the first part of the statement redundant, because the "non-class scope immediately enclosing the class " includes "previously declared in an...
how to count the number of objects created in c++
pls explain with a simple example
...
Hi all,
I need to pass data (byte array, i.e char*) from ActiveX object (using Visual C++ with ATL) to my javascript code (and vice versa). I've digged the Web for such problem and tried lots of solutions but have not succeeded. I've tried the followings:
Converting char* to BSTR and pass it to javascript (JS), but my result in JS is ...
Hi,
Could someone please help and provide me links where I can find materials/examples describing how to exchange data in the form of XML schemas between socket programs written in C/C++?
Actually I have two software tools running in different OSs, in which I coupled with socket programs written in c/c++. As both work with xml, I am loo...
I have sucessfully installed Hypertable on top of Hadoop on a small cluster of Ubunto servers. At this point the only way to access the Hypertable is via the 'ht shell' command on one of the HT servers.
Thats all very interesting, but now I want to access the hypertable database from a PC thats not part of the cluster. Preferably from C...
In C++ a stack-allocated object can be declared const:
const Class object;
after that trying to call a non-const method on such object is undefined behaviour:
const_cast<Class*>( &object )->NonConstMethod(); //UB
Can a heap-allocated object be const with the same consequences? I mean is it possible that the following:
const Class*...
I want to pop up a window to show that a program is busy with a particular time consuming task. But I don't want any buttons on it. I just want to pop it up, do the task, then remove it. I'm not sure what such a window is called and so don't know what to search for in MSDN etc. Is there some ready made API for this kind of thing or do I ...
can i overload or override methods just by using different return value ? is virtual matter in thie case ?
for example :
class A{
virtual int Foo(); // is this scenario possible with/without the keyword virtual
}
class B : public A {
virtual double Foo();
}
A* Base = new B();
int i = Base->Foo(); // will this just convert doubl...
Does anyone know how to read these files without using the interops or COM interaction? Just the direct way. Is there any spec of this format or reverse engineered stuff that could help on this?
Thanks.
...
I was looking for a multi-language (specifically English & Swedish) supporting spell-check solution that can plug into a commercial MFC/C++ application.
Top of my Google search was Wintertree, which appears to meet all criteria but is hardly cheap at $3500 for a site license. Now I know that using some open-source option could take seve...
Hi, is there any way to check if there is something in cin? I tryied peek() but if there isn't anything peek() waits for input and that isn't what I want.
Thank you
...
When I try to "Build" a project it says:
The operation could not be completed. Unspecified error
When I try to debug the debugger says:
The debugger cannot continue the process
I really don't understand what is wrong with that? The project is fine and it compiles perfectly on VS 2008.
...
How to pass a C++ object with the performSelector method? This method only allows you to pass 'objc_object*' objects, I can't cast them. I could build a wrapper, but I don't know the overall superclass for all C++ objects, so I don't know how I could build a generic wrapper (I don't want specific knowledge about the object in the wrapper...
Hello all,
I've a base class with a function template.
I derive from base class and try to have a specialization for the function template in derived class
I did something like this.
class Base
{
..
template <typename T>
fun (T arg) { ... }
};
class Derived : public Base
{
...
} ;
template <>
Derived::fun(int arg);
and in .cpp ...
I'm getting a compile error (MS VS 2008) that I just don't understand. After messing with it for many hours, it's all blurry and I feel like there's something very obvious (and very stupid) that I'm missing. Here's the essential code:
typedef int (C::*PFN)(int);
struct MAP_ENTRY
{
int id;
PFN pfn;
};
class C
{
...