I am doing something that is probably silly, but it would be nice if it worked.
I am attempting to specialize types in a way that I need my own lookup structure that is essentially global (but ideally encapsulated as a class variable), but I want the objects to be type safe, so they are parameterized.
Consequently, I have, essentially
...
Which c-sharp wrapper of Pcap is fastest?
How fast is PCap compared to using sockets?
...
Hi,
Is in multithreaded application suitable to have 1 connection per 1 connected client? To me it seems ineffective but if there is not connection pooling, how it could be done when one wants to let each connection communicate with DB?
Thanks
...
I'm using Google protocol buffers in a messaging application. The protos are often nested several levels deep, and we have taken Google's advice and made them all optional. The protos can describe many different types of overlapping messages - i.e. a message of Type == X should contain the member my_X, Type == Y should contain my_Y. Fu...
First of all, the code:
template<typename Func, typename Func2>
void ForEachField(Func normalHandler, Func2 arrayHandler = NULL, bool skipUnknowns = true)
{
for(int i = 0; i < mFields.size(); ++i)
{
Field *f = mFields[i];
if(skipUnknowns && f->IsUnknown())
continue;
if(f->GetCount() == 1 || ...
I've been trying to figure out how to reverse the order of a doubly-linked list, but for some reason, in my function void reverse() runs while loop once and then crashes for some reason. To answer some questions ahead, I'm self-teaching myself with my brothers help. This isn't all of the code, but I have a display() function which prin...
I am confused I think on C++ class structure.
I have a .h called FxMathFunctions.h and a .cpp called FxMathFunctions.cpp
the .h starts like:
class FxMathFunctions
{
public:
FxMathFunctions();
~FxMathFunctions();
and in the .cpp
I have:
#include "FxBasicTypes.h"
#include "FxMathFunctions.h"
FxMathFunctions::F...
Ok so assuming I have, somewhere in my shader, a statement as follows (Note I am enabling legacy support to share shaders between DX9 and DX10):
Texture2D DiffuseMap;
I can compile up the shader with no problems but I'm at a slight loss as to how I bind a ShaderResourceView to "DiffuseMap". When I "Reflect" the shader I rather assu...
For example, I have a script ./helloworld.sh
I would like to call it in C++, how to do that? which lib can be used?
...
EDIT: I've added a few more lines of the program to the code snippet below.
I have the following line of code in a program
BITMAP BMP;
HBITMAP hBMP;
hBMP = (HBITMAP)LoadImage(GetModuleHandle(NULL), "Test.bmp", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
if (!hBMP) return 1;
GetObject(hBMP, sizeof(BMP), &BMP);
and wh...
hello
Suppose the following piece of code
struct S {
S(int & value): value_(value) {}
int & value_;
};
S function() {
int value = 0;
return S(value); // implicitly returning reference to local value
}
compiler does not produce warning (-Wall), this error can be hard to catch.
What tools are out there to help catch...
I am confused what to do when having nested namespaces and declaration of objects.
I am porting some code that links against a static library that has a few name spaces.
Example of what I am talking about:
namespace ABC {
namespace XYZ {
//STUFF
}
}
In code what so I do to declare an object that is in namespace XYZ...
In a header I have a setup like this
namespace NS {
typedef enum { GOOD, BAD, UGLY }enum_thing;
class Thing {
void thing(enum_thing elem);
}
}
and of course another cpp file that goes along with that header. Then I have a thread cpp file that contains main(). In this cpp file I use that enum to pass to the method t...
How to create a function pointer which takes a function pointer as an argument (c++)???
i have this code
#include <iostream>
using namespace std;
int kvadrat (int a)
{
return a*a;
}
int kub (int a)
{
return a*a*a;
}
void centralna (int a, int (*pokfunk) (int))
{
int rezultat=(*pokfunk) (a);
cout<<rezultat<<endl;
}
...
I need all of my threads to check periodically that they should still be running, so that they can self-terminate when the program ends. For all but one of them, this is just a matter of checking a state variable, but the last one is a user-interaction thread, and its loop will wait indefinitely on user input, only checking the state var...
Hello,
I've been trying to set up a CBT hook for my C++ Console application with the following code:
...includes...
typedef struct _HOOKDATA
{
int type;
HOOKPROC hookproc;
HHOOK hhook;
}_HOOKDATA;
_HOOKDATA hookdata;
//CBT
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
//do not proccess m...
Is it possible in C++ to define BIT0, BIT1, BIT2 in another way in C++ without using #define?
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
I then take the same thing and make states out of those bits:
#define MOTOR_UP BIT0
#define MOTOR_DOWN BIT1
Note: I am using 32 bits only, not 64 bits. I am also usi...
I was looking at this vector drawing application called Creative Docs .Net . I noticed that I can have hundreds of shapes and moving, rotating and scaling do not lag at all. Given that all verticies must be modified, how do applications generally do these transformations as quickly as possible?
Thanks
...
Possible Duplicate:
Possible for C++ template to check for a functions existence?
I am trying to determine wether a type has a certain member. This is what i tried:
template <typename T,typename U=void>
class HasX
{
public:
static const bool Result=false;
};
template <typename T>
class HasX<T,typename enable_if_c<(sizeof...
Consider the following C++ member function:
size_t size() const
{
boost::lock_guard<boost::mutex> lock(m_mutex);
return m_size;
}
The intent here is not to synchronize access to the private member variable m_size, but just to make sure that the caller receives a valid value for m_size. The goal is to prevent the function f...