I'm trying to call a class method from C++. I've tried all combinations of
rb_intern I could think of to make it work, but I've gotten nothing.
Example class
class CallTest
def go
(do something here)
end
end
Trying to call in C++:
rb_funcall(?, rb_intern("go"), 0);
What goes in the ? space? I know if I use Qnil there, it...
I just came across a C++ SDK that makes heavy use of this really weird *new pattern. I dont understand why they do it like that at all.
What's the point of constructing objects with *new, e.g. Widget wag = *new Widget();?
Update: Interesting, they are actually doing XPtr<T> p = *new T; - must be the semantics of some smart pointer ma...
Why the following example prints "0" and what must change for it to print "1" as I expected ?
#include <iostream>
struct base {
virtual const int value() const {
return 0;
}
base() {
std::cout << value() << std::endl;
}
virtual ~base() {}
};
struct derived : public base {
virtual const int value() const {
...
Hi,
I'm porting a medium-sized C++ project from Visual Studio 2005 to MacOS, XCode / GCC 4.0.
One of the differences I have just stumbled across has to do with erasing an element from a map. In Visual Studio I could erase an element specified by an iterator and assign the return value to the iterator to get the position of the next ele...
I'm working on a project that is supposed to be used from the command line with the following syntax:
program-name input-file
The program is supposed to process the input, compute some stuff and spit out results on stdout.
My language of choice is C++ for several reasons I'm not willing to debate. The computation phase will be highly...
This is a follow-up to this question.
I'm trying to create a shared class library in C++ on Linux. I'm able to get the library to compile, and I can call some of the (non-class) functions using the tutorials that I found here and here. My problems start when I try to use the classes that are defined in the library. The second tutoria...
I have a ~100 digit string which represents a number in base 10 that I want to convert to either a string representing the number in base 2, or a bool array which represents the number's digits in binary. I can do it easily in Java using BigInteger, but I'm not sure if there is an equivalent in C++.
Function would be something like:
s...
Variables "protected" are prone to be malicious changed by derived class?
Should I use "private" in base class variables instead of "protected"?
...
I have embedded Ruby inside my C++ application. I have generated the bindings using SWIG.
Basically, I run the ruby file and then Ruby takes over and calls my C++ class.
Based on my previous question, I would like to get the current instance of the class that is defined in the ruby file back to the C++ class so that I may execute insta...
So I have a ResourceManager that points to a resource file with a bunch of strings in it. When I call GetString() with a key that doesn't exist in the file, I get a System.Resources.MissingManifestResourceException. I need to find out whether the Resource contains the specified key without using exception handling to control program flow...
Can anyone explain why this code gives the error:
error C2039: 'RT' : is not a member of 'ConcreteTable'
(at least when compiled with VS2008 SP1)
class Record
{
};
template <class T>
class Table
{
public:
typedef typename T::RT Zot; // << error occurs here
};
class ConcreteTable : public Table<ConcreteTable>
{
public:
type...
I have a .NET program and a Borland Win32 program that need to pass some cryptographically secure information. The plan right now is to have the .NET app create a public/private key pair, store the public key on disk and keep the private key in memory for as long as the .NET program is running.
The Borland app will then read the public...
Hi,
What I'm trying to do is to convert a double to hex string and then back to double.
The following code does conversion double-to-hex string.
char * double2HexString(double a)
{
char *buf = new char[17]; // double is 8-byte long, so we have 2*8 + terminating \0
char *d2c;
d2c = (char *) &a;
char *n = buf;
int i;
f...
I have a base class with a virtual function and I want to override that function in a derived class. Is there some way to make the compiler check if the function I declared in the derived class actually overrides a function in the base class? I would like to add some macro or something that ensures that I didn't accidentally declare a ne...
Trying to add a custom header item to a Lotus Notes email item, from the context of a Notes Client Extension before the mail is sent from the Lotus Notes client app.
Is this possible?
I'm looking along the lines of using something in the NSFItemSetText family of functions if at all possible, as opposed to the lotus script object model ...
C++0x introduces concepts, that let you define, basically, a type of a type. It specifies the properties required of a type.
C# let you specify constraints of a generic with the "where" clause.
Is there any semantic difference between them?
Thank you.
...
Although people seem to like to complain about C++, I haven't been able to find much evidence as to why you would want to choose C over C++. C doesn't seem to get nearly as much flak and if C++ has all these problems why can't you just restrict yourself to the C subset? What are your thoughts/experience?
Exact Duplicate: What's the ad...
I'm scripting the checkout, build, distribution, test, and commit cycle for a large C++ solution that is using Monotone, CMake, Visual Studio Express 2008, and custom tests.
All of the other parts seem pretty straight-forward, but I don't see how to compile the Visual Studio solution without getting the GUI.
The script is written i...
First of all I was wondering if I should use Qt and Windows together. If so should I use VC++ 6.0 IDE or another one?
...
Two somewhat unrelated questions:
Sometimes when I am working on a C++ project in Visual Studio 2008 Express, intellisense just does not want to "work" even though it really should. Auto completion box does not show and status bar says something along the lines of: "Intellisense: No further information is available".
Sometimes it can b...