There's a ton of information available on overloading operator<< to mimic a toString()-style method that converts a complex object to a string. I'm interested in also implementing the inverse, operator>> to deserialize a string into an object.
By inspecting the STL source, I've gathered that:
istream &operator>>(istream &, Object &);
...
Hi. I have a c++ app that I'm trying to port to iPhone and to start off I'm trying to replace my c++ texture loader with an obj-c++ texture loader so that I can make use of the cocoa libraries.
A lot of my c++ files (.cpp files) call the texture loader with something like:
GLuint mTexture = TextureLoader::LoadTexture("file.png") //Load...
I have a 2D array of p*q. I want to sort this array in bunches of 2D arrays of m*n where p>m and p=km and q>n and q=kn
and where k is and integer.
for example
i have array of 16*16 and i have divided it into 2d arrays of 4*4 now i want to sort these 4*4 arrays independently.
Which algorithm can i use to sort these in place.means without...
I'm trying to create a vector for D3DXMATRIXA16 like so: vector<D3DXMATRIXA16> matrices; and am getting the error:
d:\Program Files\Microsoft Visual Studio 9.0\VC\include\vector(717) :
error C2719: '_Val': formal parameter
with __declspec(align('16')) won't be
aligned
e:\projects\emuntitled\em\emscratch\emshadow.h(...
Hi,
I am trying to run blocking_udp_echo_server.cpp from Boost asio example on MacOSX 10.5.
But it crashes:
From the console:
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:
error: attempt to copy-construct an iterator from a singular iterator.
Objects involved in the operation:
iterator "this" @ 0...
Preferably using C++. Or a tool I can use from the command line. So far I've figured out how to extract icons from .exe files, but I can't set icons... Any suggestions?
...
In a project I have 2 classes:
// mainw.h
#include "IFr.h"
...
class mainw
{
public:
static IFr ifr;
static CSize=100;
...
};
// IFr.h
#include "mainw.h"
...
class IFr
{
public float[mainw::CSize];
};
But I cannot compile this code, getting an error at the static IFr ifr; line. Is this kind of cross-inclusion prohibited?
...
Hi,
I try to create a thread in QT, can declare, create and start it, however it doesn't fire Run function (I can see that via putting a breakpoint in that function)
VT.h:
class VT : public QThread
{
public:
void Run();
};
VT.cpp
void VT::Run()
{
..
}
and in main.cpp:
VT vt;
vt.Start();
// starts ok but no action
I am in...
Suggest some plugins you find useful in your day by day work.
Eclipse CDT repositories:
Helios: http://download.eclipse.org/releases/helios
C++ Development Tools: http://download.eclipse.org/tools/cdt/releases/helios
Plugins:
Subclipse: http://subclipse.tigris.org/update_1.6.x
Eclipse Linux Tools: http://download.eclipse.org/t...
I have experience with OCaml. You had to write a stub for every function you wanted to use to convert the types even C int <-> OCaml int.
Linking was painful a well.
I don't even want to thing about mapping C++ objects.
What about other popular languages? Is it always a pain?
EDIT:
Please avoid duplicates. And state C and C++ interfac...
I want to handle some SAPI messages from a DLL, which is some sort of plugin. How to handle messages/events inside a VC++ dll. The SAPI event handling is shown in the example at:
http://msdn.microsoft.com/en-us/library/ms720165%28VS.85%29.aspx
...
I need to use a function's/functor's returned value without knowing what type it is (that is, as a template).
While I could pass it over to a second function without a problem:
template <typename T>
void DoSomething(T value);
...
DoSomething(FunctionWhoseReturnedTypeIsUnknown(...));
I want to use the returned value inline (without ...
Defined as: Class.h
#ifndef CLASS_H_
#define CLASS_H_
#include "Class2.h"
#include <iostream>
struct Struct1{
};
struct Struct2{
};
class Class1 {
};
#endif
Then the other header file, where I use this:
#ifndef CLASS2_H_
#define CLASS2_H_
#include "Class.h"
class Class2 {
public:
Class2( Struct1* theStruct,...
Hi there,
How do you work out the alignment of an address by just looking at it?
On a 32bit system, an address of 0x12345670 means it's 16 byte aligned (because of the 0 on the end) right?
So what about:
0x12345671
0x12345672
0x12345673
etc?
Cheers,
Jon
...
Most of C++ programmers are waiting for C++0x. An interesting feature and a confusing one (at least for me) is the new nullptr.
Well, no need anymore for the nasty macro NULL.
int* x = nullptr;
myclass* obj = nullptr;
Still, I am not getting how nullptr works. For example, Wikipedia article says:
C++0x aims to correct this by
i...
I'm writing a client-server application where client should be able to automatically detect server presence in the network so that user would not have to mess with manual configuration.
I think that server should broadcast its presence somehow. What is the best way to do it?
Server is to be run on either Windows / Linux or OS X, so the...
I Have an edit control (a text field) which I want to animate. The animation I want is that it slides out, creating an extra line for this text field. I am able to animate my text field and able to make it larger, however to show the sliding animation I first have to hide it. This means the entire text fields slides out as if being creat...
#include <stdio.h>
int doHello(){
doHello();
}
int main(){
doHello();
printf("\nLeaving Main");
return 0;
}
When you run the program quits without printing the message "Leaving Main" on the screen. This is a case of Stack Overflow and because of which program is terminating but I don't see any error messages on the co...
Say I want a C++ function to perform arithmetic on two inputs, treating them as a given type:
pseudo:
function(var X,var Y,function OP)
{
if(something)
return OP<int>(X,Y);
else if(something else)
return OP<double>(X,Y);
else
return OP<string>(X,Y);
}
functions that fit OP might be like:
template <class T> add(var X,var Y)
...
I'm working on a program to solve the n queens problem (the problem of putting n chess queens on an n x n chessboard such that none of them is able to capture any other using the standard chess queen's moves). I am using a heuristic algorithm, and it starts by placing one queen in each row and picking a column randomly out of the column...