I've been working on getting my library c++ Lavish working with ruby using swig. The issue is that only some of the classes I've included in the interface file can be used and I get no errors during compilation of the bundle or loading in ruby. My swig interface file can be viewed here.
An example of what works and what doesn't.
sean$ ...
I was reading the following text from Stanford's Programming Paradigms class, and I noticed that when the author uses the string class, the constructor does a function call that looks like this:
string::string(const char* str) {
initializeFrom(str, str + strlen(str));
}
If the initializeFrom function takes two char* arguments, how...
I have a sorted collection of
class Thing
{
public:
item a;
item b;
other data;
};
vector<Thing> Things;
using
class MultiValuedComparator
{
public:
item a;
item b;
MultiValuedComparator(item c, item d)
{
a = c;
b = d;
}
};
Since I have duplicates of item a, and item b (but not other data), I...
Possible Duplicate:
Getting a FILE* from a std::fstream
Is there a way to obtain a FILE* from an a iostream derived class? Particularly from an fstream?
...
I wrote this really simple game in SDL using C++ and now i want to show some of my friends who are on windows. I wrote my program in ubuntu 9.10 using code blocks. I want to take my source code and make a windows installer so they can install it and play. How can i go about doing this?
...
Just wondering is this kind of code recommended to increase performance?
void functionCalledLotsofTimes() {
static int *localarray = NULL;
//size is a large constant > 10 000
if (localarray == NULL) localarray = new int[size];
//Algorithm goes here
}
I'm also curious how static variables are implemented by modern c++ c...
What is stack unwinding? Searched through but couldn't find enlightening answer!
Thanks in advance.
...
After reading a description about swapping pointer addresses on Stackoverflow, I have a question about C++ syntax for references.
If you have a function with the following signature:
void swap(int*& a, int*& b)
What is the meaning of int*& ? Is that the address of a pointer to an integer? And furthermore being that it is a pointer re...
In standard library, I found that namespace std is declared as a macro.
#define _STD_BEGIN namespace std {
#define _STD_END }
Is this a best practice when using namespaces?
The macro is declared in Microsoft Visual Studio 9.0\VC\include\yvals.h. But I couldn't find the STL files including this. If it is not included, how it c...
Hi,
I am trying to create a circular buffer in shared memory using Boost circular_buffer and Interprocess libraries. I compiled and ran the the example given in the Interprocess documentation for creating a vector in shared memory with no problem. However, when I modify it to use the Boost circular_buffer as:
int main(int argc, char *...
Basically I'm doing the following:
std::set<int> indices;
// ..fill indices
if (flag)
{
// we need to process in ascending order
BOOST_FOREACH (int i, indices)
{
process(i);
}
}
else
{
// we need to process in descending order
BOOST_REVERSE_FOREACH (int i, indices)
{
process(i);
}
}
I wonder if ...
I need to write a lab report for a program I made. I need to provide a "top-down discussion of design." What does that mean?
...
Hi,
this was an interview question!
would the size of an integer depend upon the compiler or processor?
...
I have a 3D model, composed of triangles. What I want to do is, given a point near to the model, I would like to color the model (triangles) to another color, say blue.
Right now, I have a bounding sphere about the model, and when the collision occurs, I just want to approximately color the portions of model from where the collision occ...
So i have a interface class
class interfaceClass
{
public:
virtual void func1( void ) = 0;
virtual void func2( void ) = 0;
protected:
int m_interfaceVar;
}
and a class that inherits from it.
Why can't i set the member variable of the interface class as follows.
class inhertitedClass : public interfaceClass
{
inher...
Like in Just In Time debugging, does VS 2003 compiled apps catch Win32 (or asynchronous) exceptions in a catch (...) and unwind the stack? before the dump file is written...
...
I want the data at pixel to be compared with the colour and then i want to find contour then take centroid points of the contour ,so i am using like this to find countourdata am i wrong at this statement
int pos = i * w * Channels + j; //channels is 3 as rgb
// if any data exists
if (data->imageData[pos]>0)
Code i...
Hey,
I know the difference between Sax and Dom is pretty substantial regarding parsing Xml, but what about creating ones ? is there even a way to create new Xml using Sax or that if i want to create new Xml file based on my data in my program , i will have to use DOM ?
Thanks
...
I'm getting error on second memcpy
memcpy(&check_user, &ZZZ, (int)&main - (int)&check_user);
"Unhandled exception at 0x72cc1f57 (msvcr100.dll) in 11.exe: 0xC0000005: Access violation writing location 0x00f31000."
What is wrong?
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <stdio.h>
#include <iostream>
#define P...
Struct {
byte F1[2]
SHORT F2
byte F3[512]
} BPD
CBD
{
SHORT CLENGTH
byte DATA[]
}
Above are 2 c++ structure. Here SHORT is of 2 byte signed.
What would be the best way to convert it into C#?
(Note that in 2nd struture length of DATA is uundefined.)
I have seen following two links.
http://stackoverflow.com/questions/415214/fix...