For some strange reason, I need to call the operator->() method directly. For example:
class A {
public:
void foo() { printf("Foo"); }
};
class ARef {
public:
A* operator->() { return a; }
protected:
A* a;
};
If I have an ARef object, I can call foo() by writing:
aref->foo();
However, I want to...
I am using the extended TAPI function lineRegister to register a GPRS radio on the network after powering the radio on using lineSetEquipmentState. The lineRegister function is returning successfully before the network is actually registered.
The asynchronous lineRegister function first returns a positive number indicating the functi...
Hi,
I'm looking for a way to display an overlay (hud) for a third party application on MacOSX. It should look like this.
My working steps would be:
find window by title
get resolution of window
create own invisible window
check for moving events of target window
I'm not very familiar with MacOS programming with Carbon and Cocoa and...
Let's say we have a simple recursion like.
int x(int a){
if(a<10)
x(a+1);
else
!STOP!
b++;
return b;
}
Globaly:
int b=0;
In main we could have something like this:
int p=x(1);
Is there any way to stop the recursion so that the p will be 0, this means that "b++" will never be executed.
I'll be grateful ...
IBM explains C++ pass by reference in the example below (source included).
If I changed void swapnum... to void swapnum(int i, int j), would it become pass by value?
// pass by reference example
// author - ibm
#include <stdio.h>
void swapnum(int &i, int &j) {
int temp = i;
i = j;
j = temp;
}
int main(void) {
int a = 10;
...
I have a friend who wants to learn C++, but does not want to pay. I found Cplusplus tutorial, but I was wondering if there was any other material available for free.
I've had a look at Thinking In C++, but I feel it may be a bit advanced (totally new person).
Thanks.
...
In boost::numeric::ublas, there are three sparse vector types.
I can see that the mapped_vector is essentially an stl::map from index to value, which considers all not-found values to be 0 (or whatever is the common value).
But the documentation is sparse (ha ha) on information about compressed_vector and coordinate_vector.
Is anyone ...
I need to insert 10-million strings into a C++ STL set. The strings are sorted. Will I have a pathological problem if I insert the strings in sorted order? Should I randomize first? Or will the G++ STL implementation automatically rebalance for me?
...
Hey, I know someone who is looking into developing simple video games on his pc, and then eventually, hopefully port or develop some on the XBOX 360 indie center, using XNA studio.
So, I have heard about C#? How easy it for a beginner?
C++ is pretty good isn't it? But I've heard it's QUITE deep, broad, and sounds pretty easy to get l...
I have a C++ class where I'm trying to use std::bind1st to bind a member function to the 'this' parameter. For example:
class MyClass
{
public:
void Foo()
{
using namespace std;
// this works fine
this->Bar();
// this also works fine
mem_fun( &MyClass::Bar )( this );
// this does not
...
What's the meaning of the -O4 optimization flag in gcc (3.2.3)? What's the difference to O3? When would you use one vs. the other?
The man pages only mention O, O0-3, Os, no word of the mysterious O4. Thanks!
...
was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification?
...
We have a qthreads-based workflow engine where worker threads pick up bundles of input as they are placed on a queue, then place their output on another queue for other worker threads to run the next stage; and so on until all the input has been consumed and all the output has been generated.
Typically, several threads will be running t...
Hi! This is wholy mysterious to me. I'm using g++ on ubuntu, and this is some of my code (with class names change, but nothing else because I'm still using stubs everywhere):
Bob.hpp
template <class A>
class Bob : public Jack<Chris, A>
{
public:
Bob(int x1, int x2, float x3 = 1.0, float x4 = 2.0, float x5 = 3.0) throw(Exc...
I had a DLL project on one machine, and copied it to another with freshly installed VS2008. The project builds, but I cannot debug it. Dependecy Walker shows that my DLL sees msvcr90d.dll, but msvcp90d.dll does not see the same DLL. But if I open msvcp90d.dll in separate window then msvcr90d.dll is visible to msvcp90d.dll. This is obviou...
While this seems like a duplicate of Crypt Kicker Problem, it isn't.
I've solved the problem, but I'm not all together that satisfied with my solution. The problem statement is:
A common but insecure method of encrypting text is to permute the letters of the alphabet. In other words, each letter of the alphabet is consistently replace...
This has been stumping me for a bit. I have a Class written in C++.
Everything works fine.
Next, I add funtion void A(); to the header file and run, It still works fine.
However as soon as I add a new function definition to the CPP file, I get a runtime error every single time. (specifically: Process terminated with status -1073741510 (...
I have converted a dll to lib. I gave it the lib and dll file and told it to remove the unnecessary stuff. I #included the .h file it created, and called GLU_DLLMAIN() in InitInstance just like I saw in the samples, but it still crahes on start up when it tries to initialize my static GLU object. What am I doing wrong? what is the proper...
I need to convert an ASCII string like... "hello2" into it's decimal and or hexadecimal representation (a numeric form, the specific kind is irrelevant). So, "hello" would be : 68 65 6c 6c 6f 32 in HEX. How do I do this in C++ without just using a giant if statement?
EDIT: Okay so this is the solution I went with:
int main()
{
st...
How do I set my Visual studio 2008 compiler to GNU GCC. Can I also make it specific to projects? I didn't find any conclusive answer.
Thank you.
...