Hello,
Have a class Hero. Sometimes I need a deep copy (when all members are copied by value) of this class as a kind of some derived class:
class Hero
{
public:
// members, w/o getters/setters
public:
// Constructors
Hero();
Hero(...)
~Hero();
inline SuperHero* asSuperHero() {
...
What are the 'best practices' when it comes to debugging core dumps using GDB?
Currently, I am facing a problem:
The release version of my application is compiled without the '-g' compiler flag.
The debug version of my application (compiled with '-g') is archived (along with the source code, and a copy of the release binary).
Recent...
Hello all, I am working on a project to dynamically disable the keyboard. I have written a driver which attempts to obtain the keyboards physical device object then call IoInvalidateDeviceState with it but I am having a problem getting its physical device object. Whenever I try to call ObReferenceObjectByHandle with the handle to the dev...
How do I define a vim function such that when called with
Foo
it searches via vimgrep for
\s*class Foo
or
\s*struct Foo
?
[This is poorman's cscope/ctag; I want to be able to type in a class name, and have it search for the class.]
If this is easy, is there a way I can tell it to look under my cursor to use that 'word' as the ...
The problem I have, I have to add to a vector, the missing chars.
For example I have initially
s,a,p,i,e,n,t,i,a
and I have to add missing chars to it
s,a,p,i,e,n,t,i,a,b,c,d ...
I am trying to use this code to search for an existing value.
for(char c='a';c!='z';++c)
{
if (vec.end()!=find(vec.begin(),vec.end(),c))
...
Hi,
I want to use Intel Threading Building Blocks (TBB) in Linux. Can anyone suggest a good IDE for that and possibly any steps to integrate TBB with that IDE?
Thanks,
Rakesh.
...
hi,
I am writing a code in C++ and want to compute distance between two points.
Question 1:
I have two points P(x1, y1, z1) and Q(x2, y2, z2) , where x, y and z are floats/doubles.
I want to find the distance between these two points. One way to do it is :
square_root(x_diff*x_diff + y_diff*y_diff + z_diff*z_diff)
But this is ...
I have Visual studio 2005 . One of my header file has a enum like
typedef enum { scalar, array, set } increment;
When I try to include the header file I get an ambiguity error for "set".
I am using the std::set in this cpp file . The issue is the compiler is unable to differentiate between the std::set and the set in the enum .
Any ...
I wrote code that looked like the following:
template<typename CocoaWidget>
class Widget : boost::noncopyable
{
private:
CocoaWidget* mCocoaWidget;
public:
Widget()
{
mCocoaWidget = [[CocoaWidget alloc] init];
}
// ...
};
class Button : Widget<NSButton>
{
// ...
};
But that doesn't work, because Mac Dev Center says:...
hi everyone
i need to build a c++ project that exports functions to c project
this is my c++ class :
** MyCppClass.h **
class MyCppClass
{
public:
static void MyCppMethod()
}
** MyCppClass.cpp **
void MyCppClass::MyCppMethod(){}
*now i need to create an interface for the Method MyCppMethod (static).
i did that :
** MyExport.h**
...
I'm looking at integrating multipart form-data parsing in a web server module so that I can relieve backend web applications (often written in dynamic languages) from parsing the multipart data themselves. The multipart grammar (RFC 2046) looks non-trivial and if I implement it by hand a lot of things can go wrong. Is there already a goo...
Hello.
c++ question.
for(i=1;i<10000;i++){
cout << myfile.get();
}
Will program make 10000 IO operations on the file in HDD? (given that file is larger)
If so, maybe it is better to read lets say 512 bytes to some buffer and then take char by char from there and then again copy 512 bytes and so on?
...
I've a class that internally uses a worker thread. Currently the ctor starts the thread and the dtor stops (and waits for) it. Is this considered good code? I think it would be better to have separate start() / stop() functions for this purpose.
One of the problems is that stopping and waiting for the thread may throw exceptions, which ...
I would like to capture some sound from the microphone in cpp, in order to use it in a Qt application.
So I'm looking for a multi platform library easily integrable in a Qt4 project.
...
In my template-ized function, I'm trying to check the type T is of a specific type. How would I do that?
p/s I knew the template specification way but I don't want to do that.
template<class T> int foo(T a) {
// check if T of type, say, String?
}
Thanks!
...
Hi I have a text file containing two arrays and one value(all integers)
like this
3 90 22 5 60 33 24
Where the first number stands for how many integers to read in.
I can read in all this in one function.
Do I need several functions to be able to use the different matrices and the first variable?
ifstream in(SOMEFILE.dat);
if...
Whenever I compile SQLite with Visual C++ 9 I get hundreds of warnings, such as
potentially uninitialized variables
conversion from wider integer types to narrower integer types
signed/unsigned integers mismatches.
I'm not alone - there's an SQLite FAQ question specifically about that. The answer to that question says that
those wa...
What are my options for pubsubing (or point to point but pubsub is better) messages to and from an IBM message broker from an embedded headless C/C++ linux client that doesn't have a JVM?
Ideally we want
large file transfer (2GB once per day off of the client)
encryption (SSL)
reliable ('assured' delivery / QoS2, maybe QoS1 would do)
...
Hello all!
I have the following class
class Node
{
int key;
Node**Nptr;
public:
Node(int maxsize,int k);
};
Node::Node(int maxsize,int k)
{
//here i want to dynamically allocate the array of pointers of maxsize
key=k;
}
Please tell me how I can dynamically allocate an array of pointers in the constructor -- the size...
I have some input containing UTC time formatted according to iso8601. I try to parse it using QDateTime:
const char* s = "2009-11-05T03:54:00";
d.setTimeSpec(Qt::UTC);
d = QDateTime::fromString(s, Qt::ISODate);
Qt::TimeSpec ts = d.timeSpec();
When this fragment ends, ts is set to localTime and d contains 3 hours 54 minutes. Do...