hi there
i need to compare the size of 10 queues and determine the least one in size to insert the next element in
creating normal if statements will take A LOT of cases
so is there any way to do it using a queue of queue for example or an array of queues ?
note :
i will need to compare my queues based on 2 separate things in 2 situat...
I have a variable that I would like to use in all my classes without needing to pass it to the class constructor every time I want use it. How would I accomplish this in C++?
Thanks.
...
I have some trouble forward declaring a function that uses boost::enable_if: the following piece of code gives me a compiler error:
// Declaration
template <typename T>
void foo(T t);
// Definition
template <typename T>
typename boost::enable_if<boost::is_same<T, int> >::type foo(T t)
{
}
int main()
{
foo(12);
return 0;
}
Wh...
I am trying to write a triple vector to a file and then be able to read back into the data structure afterward. When I try to read the file back after its been saved the first fifty values come out correct but the rest of the values are garbage. I'd be really appreciative if someone could help me out here. Thanks a lot!
File declaration...
hello,
i have a hex valued string that is saved in a text file. I want to get it into a c style include format to just copy and paste into my code. i tried using xxd that has a feature to do that but for some reason when i use my file it takes that string (it considers it non hex) and further converts it into hexadecimal.
anyway ar...
Hello!
I have the following problem with a program which I wrote in Visual C++ and I hope that anyone can help me please:
typedef struct spielfeld
{
int ** Matrix;
int height;
int width;
Walker walker;
Verlauf history;
} Spielfeld;
void show(Spielfeld fieldToShow); //Prototype of the Function where I have this
...
Say there is a list of integers [1,2,3,4,5] and a map function that multiplies each element with 10 and returns modified list as [10,20,30,40,50] , with out modifying the original list.
How this can be done efficiently in c++.
...
Why, in C++, do we prefer static initialization to dynamic initialization?
Whats the big deal?if static initialization is so performant then why do new languages like Java, C# use dynamic initialization?
...
I'm trying to statically link to libcrypto.a (from the openssl library) after building it from source with a new toolchain. However whenever I try to use any of the functions from that library, I keep receiving "undefined reference" errors. I've made sure the right header file was included. I've also double checked the symbol table of li...
How do I achieve the dynamic equivalent of this static array initialisation:
char c[2] = {}; // Sets all members to '\0';
In other words, create a dynamic array with all values initialised to the termination character:
char* c = new char[length]; // how do i amend this?
...
As per the MSDN doc on __interface, a Visual C++ interface "Cannot contain constructors, destructors, or operators."
Why can't an interface contain an operator? Is there that much of a difference between a get method that returns a reference:
SomeType& Get(WORD wIndex);
and the overloaded indexer operator?
SomeType& operator[](WORD ...
I have a C++ executable and I'm dynamically linking against several libraries (Boost, Xerces-c and custom libs).
I understand why I would require the .lib/.a files if I choose to statically link against these libraries (relevant SO question here). However, why do I need to provide the corresponding .lib/.so library files when linking m...
So I have a function that creates a dynamic array, I then delete the array before I leave the function (as I thought I am supposed to), however I am getting a 'Heap Corruption Detected' warning in VS2008. If I remove the line that deallocates the memory everything works fine:
void myFunc()
{
char* c = new char[length];
memset(c,...
I have written a program that captures sound via waveInOpen() in Wuindows. It works great on the michrophone-device on the main-board, but when I try to capture from the second sound-card, I get only [static] noise. Recording with SoundRecorder works great on both cards. Does any1 know if there are any known problems with waveInOpen() an...
Could someone point me to an article, or write some tips right here about some c++ programming habits that are generally valid (no real drawbacks) and improves performance? I do not mean programming patterns and algorithm complexity - I need small things like how you define your functions, things to do/to avoid in loops, what to allocat...
How do you find out what number each sys call is? Like on SP3 ZwCreateFile is
ZwCreateFile:
mov eax, 0x25
mov edx, 0x7ffe0300
call [edx]
retn 0x2c
How do you find out that ZwCreateFile is 0x25?
...
Hi,
I need to develop some kind of application and use DB in it.
Let's say i want to develop it over Windows currently, however, in a couple months i may have to migrate it to Linux.
I started reading a little bit about it, but couldn't get to point i needed.
Is there or isn't a generic/protable/standart api for using DB ?
I read th...
I am trying to render a GStreamer pipeline running on top of a XUL window.
For this I wrote an XPCOM plugin. A XPCOM plugin is basically a dll file that gets loaded by the Gecko engine. My plugin links with GStreamer and as a consequence it depends on many other GStreamer plugins (also dll files).
Invoking GStreamer code (for example a...
I am trying to read a bmp file using fstream.
However it skips the values between 08 and 0E (hex)
for example, for values
42 4d 8a 16 0b 00 00 00 00 00 36
it reads
42 4d 8a 16 00 00 00 00 00 36
skipping 0b like it does not even exist in the document.
What to do?
code:
ifstream in;
in.open("ben.bmp", ios::binary);
unsigned char a='\...
Is there a reference somewhere concerning all the C++ extensions the VC9 (SP1) compiler has?
Examples would be the __declspec stuff, variadic macros and the compiler intrinsics, although there are also some less noticeable ones like being able to have template function specialisations at class scope, whereas apparently the standard say...