In order to traverse grids with data in a fast and flexible way I set up an abstract, templated GridDataStructure class. The data should be accessed by STL iterators. When someone uses the class, he should not worry about which kind of STL iterator is appropriate for a specific subclass.
A solution to this problem seems to be http://st...
I didn't know that C and C++ allow multicharacter literal: not 'c' (of type int in C and char in C++), but 'tralivali' (of type int!)
enum
{
ActionLeft = 'left',
ActionRight = 'right',
ActionForward = 'forward',
ActionBackward = 'backward'
};
Standard says:
C99 6.4.4.4p10: "The value of an
integer character const...
Hello all,
I got a C++ object oriented program that was working right. I have decided to modify it by adding some polimorpysm definining a class hierarchy with virtual methods. When I call the virtual method it produces an fault segmentation error, likely because I have trash in the object.
This is the call and the warming up
GPU...
I have recently migrated the code fom 32 bit to 64 bit and have a query. I am geting core in my code after 64 migration.
int main (int ac, char *av[])
{
char myTable[51];
memset(myTable, 0x00, sizeof(myTable));
myFunc(ac, av, myTable);
}
myFunc(int argc, char *argv[], char* myTable)
{
Config config;
/*** confi...
I had a working project. After rearranging some code, I tried to recompile my project and then weird things started happening. Have a look at this excerpt from the compiler's output. I'm compiling from Eclipse on Windows using MinGW G++.
**** Build of configuration Debug for project Pract2 ****
**** Internal Builder is used for build ...
I saw this question been asked at SO few hours ago.
My question is related to it but just a bit different and is a result of Johannes Schaub-litb's comment to Oli Charlesworth's answer.
Is i = (0, ++i, 0) undefined behavior?
P.S:
This is just for educational purpose and has no relation with real life code or examples. Please ignore th...
Possible Duplicate:
How much faster is C++ than C#?
Hello!
Are there any cases in which C# is faster (has better performance) than C++ in practical use?
I heard that generic collections are a significant performance advantage over stl - is that true?
Has native code written in C# (unsafe block, pin pointers, Marshal...) the...
This code fragment:
namespace ns
{
struct last;
struct first
{
typedef last next;
};
template <typename T>
struct chain
{
chain<typename T::next> next;
};
template <>
struct chain<last>
{
};
}
using namespace ns;
template <typename T>
void f(const T& x) // #1
...
Why isn't 0f treated as a floating point literal in C++?
#include <iostream>
using namespace std;
int main(){
cout << 0f << endl;
return 0;
}
Compiling the above gives me
C2509 (syntax error: 'bad suffix on number')
using VS2008.
...
I know when it's a matter of accessing memory of a stack frame it'll be through using stack frame pointer but I wonder about how the access to data, BSS segments containing global/static data will be, through using a pointer like stack frame pointer indicating starting point of those segments or instructions address pieces of those segme...
For example, multithreading would never work if mutexes were not resilient to multithreaded access (e.g., two simultaneous calls to mutex.lock() can't screw things up).
Does this extend to condition variables too? Specifically, I want to release a lock and then call cond.notify_one(). Theoretically, another thread could then grab the lo...
I have a function definition, where i call multiple functions. Even if one of the function fails i need to go ahead and call the rest of the functions and finally return a single error saying whether any of the function call failed. The approach which i had followed was
int function foo()
{
int res, res1, res2, res3;
res1 =...
How to disable aero effects in C# .NET or C++ Win32 ???
This is my test code in C/C++, but only works if my app is runnig
#include <dwmapi.h>
int main()
{
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
while(true);
//...
return 0;
}
//LINK dwmapi.lib
Thanks
Edit: i figured it out
#include <Windows.h>
#include ...
Hello!
I'm working on a software that I would like to offer for free in charge with advertisement banners inside the application. Something like the banners in Spotify or the banner in the MS Live Messenger Contact List. Something like the iAd system that integrates in iOS-applications.
Are there any solution for this? I'm programming ...
Hello, I have been trying to understand the Placement new concept. I searched on the internet for some examples. And with all that info I created one example myself, here´s the code:
#include <iostream>
#include <cstdlib>
#include <new>
using namespace std;
class MyClass
{
private:
size_t num;
public:
~MyClass(void)...
A program contains the following funcion
void display(in arg1, double arg2, char arg3)
{
cout << "here are the values:"
<< arg1 << " " << arg2 << " "
<< arg3 << endl;
}
Write a statement that calls the procedure and passes the following variables to it:
Int age;
Double income;
Char intitial;
...
Is it possible to store a templated class like
template <typename rtn, typename arg>
class BufferAccessor {
public:
int ThreadID;
virtual rtn do_work(arg) = 0;
};
BufferAccessor<void,int> access1;
BufferAccessor<int,void> access2;
in the same container like a vector or list
edit:
The purpose for this is I am trying to ...
I know good programming practices always help in the "long run" for a project, but sometimes they just seem to cost a lot of time. For instance, its suggested that I maintain a header file and a cpp file for each class that I make, keep only the declarations in the headers while definitions in cpp. Even with 10-12 classes, this process b...
I am very interested in some studies or empirical data that shows a comparison of compilation times between two c++ projects that are the same except one uses forward declarations where possible and the other uses none.
How drastically can forward declarations change compilation time as compared to full includes?
#include "myClass.h"
...
Possible Duplicates:
Detect Antivirus on Windows using C#
How to detect if a virusscanner and/or firewall is installed? (And a few other security-related Q's.)
is there a way to detect currently instaled av without searching for known processes?
...