I have a list of elements around 1000. Each element (objects that i read from the file, hence i can arrange them efficiently at the beginning) containing contains 4 variables. So now I am doing the following, which is very inefficient at grand scheme of things:
void func(double value1, double value2, double value3)
{
fooArr[100...
I want to have some data cache which contains some objects which I can update over an UpdateCache function. However, I'm getting problems with a LNK2001 followed by a LNK1120.
HeaderFile.h
#ifndef headerfile_included
#define headerfile_included
#include <vector>
struct MyObject {
unsigned int A;
unsigned int B;
};
class MyClass...
I have a strongly recursive function, that creates a (very small) std::multimap locally for each function instance using new (which recurses to malloc/calloc in the std lib). After some hundred recursions new fails although i am using a native 64Bit application on Windows XP x64. The machine has 10 GB RAM, The application only uses about...
I have created a DLL to replace GINA.
When I call WlxDialogBoxParam to display my own logon dialog, the dialog does not get active. What am I doing wrong?
I have tried o call SetActiveWindow on the WM_INITDIALOG event, but that did not seem to help.
I call the WlxDialogBoxParam with the following parameters:
WlxDialogBoxParam(hWlx, Get...
I'm eager to learn about Stepanov's approach to programming described in the book Elements of Programming. Does anyone here have experience with these methods, or can point me to some online resource where this topic matter is discussed?
I've seen the Adobe's Google Tech Talk on A Possible future of software development.
...
Apparently, there's a fairly easy way to host Explorer in your app starting with Vista:
http://www.codeproject.com/KB/vista/ExplorerBrowser.aspx
However, that interface is only available starting with Vista.
I see that there is another way to do it: "going all the way back to 95, but it requires more work - implement IExplorerBrowser a...
(Leaving aside the question of should you have them at all.)
I have always preferred to just use function overloading to give you the same name for both getter and setters.
int rate() { return _rate; }
void rate(int value) { _rate = value; }
// instead of
int getRate() { return _rate; }
void setRate(int value) { _rate...
Ever since I realized many years ago, that this doesn't produce an error by default, (in gcc at least) I've always wondered why?
I understand that you can issue compiler flags to produce a warning, but shouldn't it always be an error? Why does it make sense for a non-void function not returning value to be valid?
An example as requeste...
Hi,
the question is simple...
is there any difference in using this->yourvariable or yourvariable directly for some reason?
I am not finding any problem with that, but I am using this-> a lot and would like to know if there is any difference before going further.
I saw a comment on a post here and I don't remember which thread, but th...
Hi, Does anyone know what's the best graphic drawing library for C++, I want a lib that can draw basic shapes and can make image editing, gradients and vector or 3D would be great to.
The windows drawing functions are complicated and are not very advanced.
Thank's.
...
Is there any sense to step-execute release code? I noticed that some lines of code are omitted, i.e. some method calls. Also variable preview doesn't show some variables and shows invalid (not real) values for some others, so it's all quite misleading.
I'm asking this question, because loading WinDbg crashdump file into Visual Studio br...
There are countless articles and blogs discussing C++'s most vexing parse, but I can't seem to find any with a more substantial reference than "the C++ literature."
Where did this term come from?
...
Say I have nested methods a, b, c, d, e on each level we return errors in the normal course of operations, but e could also throw an exception (e.g. out of memory on STL insert). The exceptions are very seldom and how fast/slow actual unwinding is happening is not an issue.
What is the most appropriate strategy for exception handling i...
Write a branchless function that returns 0, 1, or 2 if the difference between two signed integers is zero, negative, or positive.
Here's a version with branching:
int Compare(int x, int y)
{
int diff = x - y;
if (diff == 0)
return 0;
else if (diff < 0)
return 1;
else
return 2;
}
Here's a versio...
LLVM has it's own hand rolled alternative to RTTI that is a speed improvement over built-in RTTI and allows dynamic casting to classes with no vtable (dyn_cast). However, it can still be used in exactly the way that dynamic_cast<> is used though it does allow it to be used with more classes.
dyn_cast<> template documentation
LLVM is a ...
Hello,
What do gdb users here think about its capabilities in regards to debugging code with templates and STL?
Do you use any tricks to make the debugging any simpler? Perhaps some Python scripts? Or are you satisfied the way it is at present in gdb (ver 6.x, haven't tried 7.x yet)?
Thanks.
...
According to the reference, if I use ifstream infile ( "test.txt" , ifstream::in ); it will Allow input operations on the stream. But what are some of the examples of the "input operations"?
Is ifstream infile ( "test.txt" , ifstream::in | ifstream::binary ); the right syntax to use multiple flags?
Will it make a difference if I change...
Hi there,
I have to program a C/C++ application. I have windows and linux (ubuntu 9.04) in my machine, and can program in both of them (via gcc/code blocks/vim,etc). The problem is that the executable is going to be run in a Unix (not linux) machine (will have access to it in about 20 days).
My Team Leader doesn´t want all of the code...
Hi,
I am trying to write a simple UTF-8 decoder for my assignment. I'm fairly new with C++ so bear with me here...
I have to determine whether the encoding is valid or not, and output the value of the UTF-8 character in hexadecimal in either case. Say that I have read the first byte and used this first byte to determine the number of b...
I have a method like the one shown below.
Will the for loop always make the compiler for go the "inline request" ?
inline void getImsiGsmMapFrmImsi
(
const string& imsiForUEDir,
struct ImsiGsmMap& imsiGsmMap
)
{
for (int i = 0 ; (unsigned)i < imsiForUEDir.length() - 1 ; i++)
{
imsiGsmMap.value[i] = imsiForU...