Hi,
In PortAudio's C++ bindings, there is a MemFunCallBackStream constructior that can be called as:
portaudio::MemFunCallbackStream<MyClass> streamRecord(paramsRecord,
*AnInstanceOfMyClass,
&MyClass::MemberFunction);
where last...
Has anyone tried to use gold instead of ld?
gold promises to be much faster than ld, so it may help speeding up test cycles for large C++ applications, but can it be used as drop-in replacement for ld?
Can gcc/g++ directly call gold.?
Are there any know bugs or problems?
Although gold is part of the GNU binutils since a while, I have...
Hi,
I have this example code:
#include
template<class T>
class Class
{
public:
typedef boost::shared_ptr<Class<T> > Ref;
};
template<class T>
class Class2
{
public:
Class<T>::Ref getAReference() {return Class<T>::Ref(new Class<T>);};
};
int main(){}
When I try to compile it, I get:
test.cpp:14: error: type ‘Class<T>’ i...
Hi, suppose a C++ class has several constructors which are overloaded according the number and type and sequences of their respective parameters, for example, constructor(int x, int y) and constructor(float x, float y, float z), I think these two are overloaded methods, which one to use depends on the parameters, right? So then in python...
After reading this question on signed/unsigned compares (they come up every couple of days I'd say):
http://stackoverflow.com/questions/3475841/signed-unsigned-comparison-and-wall
I wondered why we don't have proper signed unsigned compares and instead this horrible mess? Take the output from this small program:
#include <stdio.h>...
How does a variable in C/C++ work?
I mean, a pointer stores an address from a variable and then you have to dereference it to access the object to which it refers, so I think that a variable is a pointer that is dereferenced automatically when used... does that make any sense?
BTW, I didn't find an answer to this on google...
Thank yo...
Hello,
I'm trying to build a very simple OpenGL-app under Ubuntu 10.04 (I have a 32 bit system).
When I'm trying to compile the file, I get the error message:
g++ -L/usr/lib simple.cpp -lglut
/usr/bin/ld: /tmp/ccoPczAo.o: undefined reference to symbol 'glEnd'
/usr/bin/ld: note: 'glEnd' is defined in DSO //usr/lib/libGL.so.1 so try add...
Hi I asked a question today about How to insert different types of objects in the same vector array and my code in that question was
gate* G[1000];
G[0] = new ANDgate() ;
G[1] = new ORgate;
//gate is a class inherited by ANDgate and ORgate classes
class gate
{
.....
......
void Run()
{ //A virtual function
}
};
class ANDga...
After going through MSDN Shell Extensions I am not quite sure if I can extend the behaviour of Shell Click or Click Event of explorer. Any suggestion or Code Snipet, article or Walk through?
...
When I compile the following
#include <iostream>
#define XXX 1
#define YYY 2
class X
{
public:
template< int FLD >
void func();
};
template<> void X::func< XXX >()
{
std::cout << "X::func< " << XXX << " >" << std::endl;
}
class Y : public X
{
public:
};
template<> void Y::func< YYY >()
{
std::cout << "Y::func< " <<...
Hi,
At the end of Item 52 (Customising new and delete) in Myer's Effective C++ he discusses how to avoid hiding normal new and delete versions when implementing custom version as follows:
If you declare any operator news in a
class, you'll hide all these standard
forms. Unless you mean to prevent
class clients from using thes...
Hi,
I created a server using boost:asio. When a client connects it sends a file_size, file_name and the file_data. The server stores this in a file on disk. This works perfectly! Though now I'm running both client application and server application in the main thread of their application (so I've got a server and client app) which block...
Hi!
I want to call the constructor;
class anAbstractClass
{
public: anAbstractClass(inputdatatype){/*blablabla*/}
};
class aChield : public anAbstactClass
{
/*
...
*/
}
void _engine::initShader(_anAbstractClass** inShader)
{
*inShader = new /*???*/(inputdata for the construcor)
}
aChield* theChield;
_engine* myEngine = new _engi...
Some of my code still uses malloc instead of new. The reason is because I am afraid to use new because it throws exception, rather than returning NULL, which I can easily check for. Wrapping every call to new in a try{}catch(){} also doesn't look that good. Whereas when using malloc I can just do if (!new_mem) { /* handle error */ }.
Th...
I wonder if there is ways for communicate actionscript with c/c++, as well as the level of complexity..
...
Hello,
I want to convert POSIX locale names like en_US, de_DE that use
ISO-639-1 and ISO-3166 codes
to Windows ones English_United States, German_Germany and back.
I had found following tables on MSDN site:
Languages http://msdn.microsoft.com/en-us/library/39cwe7zf(v=VS.71).aspx
Countries http://msdn.microsoft.com/en-us/library/cdax4...
vector <weight> decoy;
void clear_decoy() {
decoy.clear();
vector<weight> (decoy).swap(decoy);
}
In the above method clear_decoy(), what does vector<weight> (decoy).swap(decoy); mean please?
Does the method clear decoy or not? Thanks!
...
I have always been curious about this - why do in C++ I have to cast return value from malloc but not in C?
Here is the example in C++ that works:
int *int_ptr = (int *)malloc(sizeof(int*));
And here is the example in C++ that doesn't work (no cast):
int *int_ptr = malloc(sizeof(int*));
I heard that in C, in fact, casting an outpu...
Suppose I have a class
class Foo {
:
:
}
I have another function
void getf( Foo &f) {
:
:
std::cout<<sizeof f<<std::endl;
}
After I process the data and assign a lot of data to f (vector included in Foo members), I need the size of f object
However, as what I did above, I always get 16, which is the size of a reference here....
Why does this code result in a run-time error "vector iterator not incrementable"?
vector<string> s1, s2;
s1.push_back("joe");
s1.push_back("steve");
s1.push_back("jill");
s1.push_back("svetlana");
s2.push_back("bob");
s2.push_back("james");
s2.push_back("jill");
s2.push_back("barbara");
s2.push_back("steve");
sort(s1.begin...