So far the only tutorials I've been able to find are on directx11tutorials.com, which are essentially inferred from the existing samples. Does anyone know where to find other tutorials, or better yet open source projects using DirectX 11? (Extra points for project code using DirectX 11 :) )
...
Possible Duplicate:
What is the lifetime of a static variable in a C++ function?
Say we have a code like this:
Some class {
Some() { // the ctor code }
};
Some& globalFunction()
{
static Some gSome;
return gSome;
}
When exactly 'the ctor code' is executed? As for normal static variables before main() or at the momen...
I need to figure out the operating system my program is running on during runtime.
I'm using Qt 4.6.2, MinGW and Eclipse with CDT. My program shall run a command-line QProcess on Windows or Linux. Now I need a kind of switch to run the different code depending on the operating system.
Thx
...
Is this program well-defined, and if not, why exactly?
#include <iostream>
#include <new>
struct X {
int cnt;
X (int i) : cnt(i) {}
~X() {
std::cout << "destructor called, cnt=" << cnt << std::endl;
if ( cnt-- > 0 )
this->X::~X(); // explicit recursive call to dtor
}
};
int main(...
I understand passing a pointer, and returning a pointer:
char * strcat ( char * destination, const char * source );
You're passing a variable that contains the address to a char; returning the same.
But what does it mean to pass something using the reference operator? Or to return it?
string& insert ( size_t pos1, const string& str ...
I have a function that takes a pointer to a superclass and performs operations on it. However, at some point, the function must make a deep copy of the inputted object. Is there any way I can perform such a copy?
It occurred to me to make the function a template function and simply have the user pass the type, but I hold out hope that ...
I am writing an abstract superclass where literally every method is going to be overridden. There is some default functionality I could implement, but most of the time it's enough to leave the implementation to the subclass writer.
Since just about every method is going to be overwritten, how much should I make virtual and how much sho...
I have a superclass which is defined in terms of a few internal types it uses. Subclassing is performed as so:
template <class InternalType1, class InternalType2>
class Super
{
...
}
class Sub : Super <interalTypeClass1, interalTypeClass2>
{
...
}
But when I want to write a function that takes a pointer to the superclass, t...
Okay, im making a pretty big file in my opinion, so i wanted to separate it into several files for cleaner code. so i have my main .cpp file and two header files holding my classes. well the header files dont hold strings, it aboslutely wont budge. i call the library in both my .cpp file and even tried it in my header file.
another is...
I'm working on a system using lots of MySQL queries and I'm running into some memory problems I'm pretty sure have to do with me not handling pointers right...
Basically, I've got something like this:
MYSQL_ROW function1() {
string query="SELECT * FROM table limit 1;";
MYSQL_ROW return_row;
mysql_init(&connection); // "connec...
Hello,
I would ideally like to be able to add (very repetitive) C/C++ code to my actual code, but at compile time, code which would come from say, the stdout of a python script, the same way one does with macros.
For example, let's say I want to have functions that depend on the public attributes of a given class, being able to just wr...
Let say i have a text file with
today is today but
tomorrow is today tomorrow
then using maps how can i keep track of the words that are repeated? and on which line it repeats?
so far i have each string in the file read in as a temp and it is stored in the following way:
map<string,int> storage;
int count = 1 // for the firs...
I'm wondering what the Stack Overflow community thinks when it comes to creating a project (thinking primarily c++ here) with a unicode or a multi-byte character set.
Are there pros to going Unicode
straight from the start, implying all
your strings will be in wide format?
Are there performance issues / larger
memory requirements becau...
I have written a C++ wrapper DLL for C# to call. The DLL was tested and worked fine with my C++ test program.
now integrated with C#, I got runtime error and crashed. Cannot use debugger to see more details.
The C++ side has only one method:
#ifdef DLLWRAPPERWIN32_EXPORTS
#define DLLWRAPPERWIN32_API __declspec(dllexport)
#else
#define...
Hi,
I'm developing a game. I have a header GameSystem (just methods like the game loop, no class) with two variables:
int mouseX and int mouseY. These are updated in my game loop. Now I want to access them from Game.cpp file (a class built by a header-file and the source-file). So, I #include "GameSystem.h" in Game.h. After doing this I...
Possible Duplicate:
Testing pointers for validity (C/C++)
If I have a pointer, like char* foo, is there any way to determine if foo points to a valid location in memory? (So, foo is not NULL, and delete has not yet been called on it.)
...
So if your converting from Void* to Type* or from Type* to Void* should you use:
void func(void *p)
{
Params *params = static_cast<Params*>(p);
}
or
void func(void *p)
{
Params *params = reinterpret_cast<Params*>(p);
}
To me static_cast seems the more correct but I've seen both used for the same purpose. Also, does the dir...
I am thinking of how I can implement std::vector from the ground up.
How does it resize the vector?
realloc only seems to work for plain old stucts, or am I wrong?
...
To create an array of strings this works:
std::string array[] = {
"first",
"second",
:
"last"
};
If I try to do the same with vectors it doesn't work:
std::vector<int> array[] = {
{1, 2},
{3, 4, 5}
:
{9}
};
I get "non-aggregates cannot be initialized with initializer list".
What is the correct synta...
Does anyone have a recommendation for an ORM for qt4 (c++)? (Like a Django ORM).
...