This program reads "emails" (really just a .txt file structured like an email) and does various things with it (storing data in maps and manipulating it).
However, I'm having an unusual issue outputting the "message" of an e-mail based on searching for the subject. First - here is the code (you can probably ignore everything except the...
Update 3:
Never mind. I kinda got what I was looking for. The following gives unique identifiers inside a class.
static const int _counter_start = __COUNTER__;
static const int val1 = __COUNTER__ - _counter_start;
static const int val2 = __COUNTER__ - _counter_start;
Update 2:
Boost Preprocessor
I will be implementing something ak...
Probably exceptions is the most controversial C++ feature. Many teams including google do not use them. Of course the decision to use them or not depends on the context -- for example, in some games it might be ok to crash on out-of-memory, but not in a medical equipment control software. Apart from out-of-memory, some teams may use exce...
Is it possible to completely hide handles from QSplitter widget? I've tried to hide() them but it doesn't work — handles are still on the screen and isVisible() reporting false.
QSplitter::setHandleWidth doesn't work as expected — it doesn't hide handles when calling it with 0.
...
Have a base class A, and a derived class B which overrides function template Func:
class A
{
A() {...};
~A() {};
template <class T>
void Func(const String &sInput, T &tResult)
{...}
};
class B : public A
{
B() {...}
~B() {};
template <class T>
v...
Unlike Java or C#, primitive data types in C++ can vary in size depending on the platform. For example, int is not guaranteed to be a 32-bit integer.
Various compiler environments define data types such as uint32 or dword for this purpose, but there seems to be no standard include file for fixed-size data types.
What is the recommended...
I'm trying to make a simple drawing app in c++, but i'm having trouble finding a function that fills an ellipse, all i have found is FillRect, could someone lead me in the right direction?
Thanks
...
I have a C++ project that have like 15+ external libraries installed with a package mananger. The problem is with the package change, the newest versions of some library break things (like libblob). I wanted to know if it exists a way to not relaying on some package manager for installing our library and to make sure we always have the v...
I'm trying to create a "sparse" vector class in C++, like so:
template<typename V, V Default>
class SparseVector {
...
}
Internally, it will be represented by an std::map<int, V> (where V is the type of value stored). If an element is not present in the map, we will pretend that it is equal to the value Default from the template a...
I've been reading through beejs guide to networking to get a handle on TCP connections. In one of the samples the Client code for a simple TCP stream client looks like:
if ((numbytes = recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) {
perror("recv");
exit(1);
}
buf[numbytes] = '\0';
printf("client: received '%s'\n",buf);
cl...
I want to do something like
template <typename T>
void foo(const T& t) {
IF bar(t) would compile
bar(t);
ELSE
baz(t);
}
I thought that something using enable_if would do the job here, splitting up foo into two pieces, but I can't seem to work out the details. What's the simplest way of achieving this?
...
Background of my question is that I want to use XmCreate{Error|Warning|Info}Dialog to display some message in screen in my SDL based application before its main window is open and any program data is available. So I want the dialog to open, print the intended message, and when the user clicks on the OK button, the dialog plus the top wid...
hey guys,
as of right now the sort function that I have only sorts 1 node out of the many.
I need this function disregard the node that is sorted only after it is printed.
I've tried removing the node so that it is not considered twice for the sort, because It will keep printing that same sorted node over and over again. That didnt ...
How can I get Visual Studio to highlight my own class types?
This works fine for C# but not for C++...
...
I want a message box for Linux similar to the Windows one: It should pop up, display some text, and when the user clicks the Ok button, it should disappear and return control to the calling function.
The message box should work even if there is no application window yet at all. So it creates an application context, ties a dialog via XmC...
Are there any good memory fragmentation profilers? (linux gcc version would be nice). Valgrind cannot analyze this because it uses custom malloc/free functions.
Thanks,
Andrew
...
I have some binary files that I'd like to embed in a dll I'm compiling with VC++ Express Edition.
I have a couple ways to do it (like converting the data to arrays that I compile along with the code), but I'm not satisfied and I feel like I'm probably missing an easy, straightforward solution.
What's the cleanest, easiest way to do thi...
Hey guys,
I need to read "A Practical Introduction to Data Structures and Algorithm Analysis" by Shaffer for class but the code examples in the book are all in C++ which I do not know. I know C and Java already and was wondering if you knew any resources that helped learn enough C++ to understand these examples fast if you already know ...
Hi,
I have a class A as follows:
class A
{
public:
A()
{
printf("A constructed\n");
}
~A();
//no other constructors/assignment operators
}
I have the following elsewhere
A * _a;
I initalize it with:
int count = ...
...
_a = new A[count];
and I access it with
int key = ....
....
I'm using the Boost Parameter tutorial to create a named-parameter constructor for a playing card generator. The tutorial says to put the ArgumentPack into a base class, but I want to modify variables in the card generator class. I've thought about doing this:
class CGconstructor_base {
public:
template<class ArgumentPack>
C...