Type: Posts; User: D_Drmmr
Search took 0.07 seconds.
July 13th, 2015, 07:07 AM
If you have a tree-like structure in your data, there are several common ways to represent it in your code. Note that a tree is a special type of graph, but this goes for any type of graph.
July 13th, 2015, 02:46 AM
Slicing is only a problem is B is designed as a polymorphic base class. If that's the case, you should take either a (const) reference or (smart-)pointer to an abstract base class. You cannot store...
From the text I quoted.
Didn't read that anywhere in your text.
I agree that the focus on the use of pointers is misleading. It is not pointers that are evil, but they can be a sign of many...
I find your suggestion that value semantics are outdated and reference semantics are modern out of touch with modern programming. Reference semantics are much harder to reason about than value...
June 30th, 2015, 05:40 AM
You can use Boost.MultiArray, which allows setting an 'index base' to change the index of the first element in the array.
June 26th, 2015, 07:19 AM
Either use std::shared_ptr, or boost::enable_shared_from_this.
April 15th, 2015, 03:25 AM
Which compiler (version) are you using? Is this C or C++?
How do you create the threads?
If you want to give thread A priority over the other threads, then you should give it a higher priority....
February 28th, 2015, 09:12 AM
No more with a signed integer than with an unsigned. What's your point?
Like I said, I tried this for a while and stopped, because I realized I was over-complicating my code.
With an unsigned...
February 27th, 2015, 02:12 AM
Obviously. My point is that "the value should never be negative" is not a reason to use an unsigned type. There may still be situations where you need to take a difference or use the value in an...
February 26th, 2015, 01:20 AM
What would you gain from making the function static? It only requires more typing.
February 26th, 2015, 01:17 AM
I would strongly advice against mixing signed and unsigned integers. Just take this simple example:
int numerator = -1;
unsigned int denominator = 2;
bool isNegative = (numerator * denominator...
February 23rd, 2015, 03:18 PM
You start by writing all the tests (in this case unit tests) and then implement your class function by function to pass all the tests. This forces you to first think about all the functionality your...
February 23rd, 2015, 03:49 AM
Better to use a bool for the sign (and name it something like isPositive or isNegative), since there can only be two possible states ever.
Your setnumerator and setdenominator functions violate...
February 18th, 2015, 02:13 AM
Don't use new  in C++, there is no need for it. Use std::vector instead.
And please post the code here, rather than providing some external link.
What do you mean by "doesn't work"?
February 13th, 2015, 07:26 AM
That's not really a solution. How will this code be able to create/copy/destroy an instance of X?
Why do you want to get rid of the class template? What do you want to accomplish at a...
February 13th, 2015, 07:10 AM
Not exactly. It's not throwing the exception during stack unwinding that is the problem. The problem is when the exception thrown during stack unwinding is not caught. If you catch any thrown...
January 21st, 2015, 02:36 PM
Don't know if threads are covered in the book, but a quick way to make the program update approximately each second is to run the loop in a thread.
January 20th, 2015, 08:20 AM
Well, no, because Windows Forms requires .Net and unmanaged C++ doesn't give you that.
What do you miss?
If you mean a nice looking GUI application, then yes that's possible in C++.
January 20th, 2015, 08:15 AM
Calling sleep pretty much puts your program (well, the thread that calls sleep) into a coma. It doesn't do anything until it wakes from its sleep. One important thing your program won't do while it...
January 8th, 2015, 04:04 AM
Why not just send the dialog a custom message to tell it to update the combo box contents? Or just add a member function to the dialog class that you call directly?
November 5th, 2014, 03:02 PM
You call a dictionary application a text predictor and then conclude from that example that a dictionary is a form of text predictor. Seems like circular reasoning to me.
I would assume the...
November 5th, 2014, 02:42 PM
When you say 'hashtable size' do you mean 'number of buckets'?
I think OP meant not knowing the maximum number of data elements to be stored ahead of time.
What makes you say this is a bad idea?...
October 3rd, 2014, 03:21 AM
...and synchronize access to the string data member using a Critical Section.
September 10th, 2014, 03:40 AM
Mandatory reading: http://www.drdobbs.com/parallel/interrupt-politely/207100682
July 28th, 2014, 01:20 PM
Are you benchmarking unoptimized code? That's not very useful.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!