Type: Posts; User: GNiewerth
Search took 0.06 seconds.
June 28th, 2011, 09:24 AM
Correct. But you can typedef them. And you should prefer composition over of private inheritance because a stack isnīt a list.
June 21st, 2011, 04:48 AM
Itīs the ternary operator, itīs syntax is "exp ? A : B". When the exp evaluates to true, its return value is A, else itīs B.
March 8th, 2011, 08:55 AM
Iīd like to add that deque has a larger overhead than vector, this can be a serious problem if you need to store huge amounts of data, especially with small data types. At least STLport and...
February 4th, 2011, 03:08 AM
The easiest way:
The installer creates a registry entry containing the date of installation (maybe the prgram itself when itīs first run). Upon every start you check the current date against the...
February 1st, 2011, 07:50 AM
This will fail when the user installs the program, enters the license data and sets the system clock back to 1970...
February 1st, 2011, 03:05 AM
In conclusion itīs pretty pointless to delete the executable, because you cannot prevent the user from making a backup and running it over and over again. If you want to make sure the program cannot...
January 31st, 2011, 08:19 AM
Since I donīt know what your data looks like I chose the type T for the data stored in the vector and type U for the find criteria. const is just a promise not to alter the variables during the...
January 31st, 2011, 08:13 AM
No, itīs impossible for an application to delete its executable (at least on Windows).
This issue is usually solved by a patcher application, the patcher first checks and performs updates and then...
January 31st, 2011, 05:18 AM
Since you mentioned the Win32 API you might consider GetFileSize or GetFileSizeEx.
January 31st, 2011, 04:46 AM
bool find( const std::vector<T>& v, const U& crit1, const U& crit2 )
bool found1 = false;
bool found2 = false;
for( std::vector<T>::const_iterator it =...
January 28th, 2011, 03:06 AM
You missed one level of indirection. A pointer is a variable which stores one address, itīs not the address itself. So using the pointerīs "value" means accessing a specific memory location.
January 18th, 2011, 03:08 AM
January 10th, 2011, 04:40 AM
Instead of using raw C-style arrays for temporary variables you should seriously consider using std::vector instead.
I took a glance at your code and noticed some strange things:
January 10th, 2011, 04:19 AM
Not sure how other compilers deal with that issue, but MS compilers handle the individual expressions in an if clause as sequence points if they´re combined by && or ||. This guarantees that the...
January 5th, 2011, 04:12 AM
I donīt know how my "friends" decided, theyīre actually the four guys from the TV Series "The Big Bang Theory". :p
January 3rd, 2011, 10:13 AM
Since copying a std::string object might be expensive changing the ret_b() method to
const std::string& Sam::ret_b() const
January 3rd, 2011, 10:11 AM
1) You can eliminate the necessity of a copy constructor/assignment operator by using std::vector instead of a C-style array.
2) binary operators (i.e. operator+) should be implemented as...
January 3rd, 2011, 09:46 AM
Empirical investigations showed that all subjects always chose Spock (at least the four guys I know of), so picking lizard always wins ;)
What do you think about an algorithm that uses a range of...
August 20th, 2010, 03:43 AM
If youīre targetting Windows there are two API functions GlobalMemory/GlobalMemoryEx that return the systemīs memory statistics.
August 16th, 2010, 03:50 AM
std::map is a container that stores key/value pairs. In this case the key type is an unsigned int (the contact ID) and class Contact (the contact data itself). Basically it looks like a table...
August 12th, 2010, 07:39 AM
Ok, I see. In that case std::map is the container of your choice, because it makes the search for the next free ID much simpler and efficient than std::vector. Please look at this example:
August 12th, 2010, 03:21 AM
1) Does it make sense to store all your data in memory and occasionally save the whole data? You could perform all changes in RAM and don´t have to bother with fragmentation or holes.
2) Is it...
August 2nd, 2010, 11:14 AM
You can either omit the batch file at all and follow the approach I advised in my previous approach or specify a window coordinate where the command window cannot be seen. Use the dwX, dwY and...
August 2nd, 2010, 07:22 AM
That cannot be done with C++, you have to use the Win32 API (which should be available since you want to start the target application in Win98 compatibility mode). Your problem can be solved with 3...
June 21st, 2010, 10:30 AM
The only solution I can think of are preprocessor conditionals (#ifdef/#else/#elif/#endif), though I seriously donīt recommend using them.
Click Here to Expand Forum to Full Width