Type: Posts; User: D_Drmmr
Search took 0.10 seconds.
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.
July 23rd, 2014, 07:31 AM
This might be a (premature) optimization trick to prevent branching due to the short-circuiting behavior of &&.
Look how much easier to read your code becomes with a few local variables. You should really stop copy-pasting source code; it's a very bad habit.
Yes, you could do that. but it sounds to me like a list box is better suited for your user interface. This would also allow the user to select an item by typing multiple characters, which is much...
June 16th, 2014, 07:20 AM
I'm sure you can come up with a test case that fails the second algorithm.
As to why the first one may be too slow: a std::set keeps all its elements sorted. Dijkstra's algorithm only needs to...
That's basically the algorithm for finding a topological order. ;)
That's because there is no specialization for 'implements_load' and 'implements_store'. Don't know if you removed this to get a minimal example or if they are missing in your actual code (maybe the...
Compiles fine in VC9.
What is the complete error message you get?
April 24th, 2014, 05:32 AM
Could you please remove this BULLSHIT? Ever heard of sampling bias?
April 23rd, 2014, 03:06 PM
When we are allocating POD types, probably. But the overhead is constant, i.e. independent of sizeX and sizeY.
However, for non-POD types I think my solution will use less memory for non-tiny...
April 23rd, 2014, 01:59 AM
Assuming you use the code I posted above, you can access the data like this
int x = 1, y = 2; // second row, third column
values[x][y] = 1.23;
const int nRows = int(values.size());...
April 23rd, 2014, 01:48 AM
That's not the same. decltype(pvalue) will be double*, not double**.
I assume you meant "new double[sizeY]" inside the loop. This is also considered bad style. You perform sizeX + 1...
April 22nd, 2014, 09:06 AM
AFAIK, this is invalid in C++11 just as it is in C++03. The call to new returns a double*, which is not convertible to a double**.
April 17th, 2014, 04:37 AM
Could you please fix the compiler errors, such that people can just copy-paste the code if they want to run it?
What about the serialization "does not work"?
April 11th, 2014, 02:26 AM
Please use code tags! Your code is practically unreadable without them.
Did you step through your code with the debugger? What values are you getting for x and y?
April 11th, 2014, 02:25 AM
That's horrible. Why would you advice someone to use a macro for this? A simple text-replace can solve this without obfuscating the code.
@OP Using two different names for the same variable will...
April 9th, 2014, 01:37 AM
What do you mean with "doesn't work"?
April 9th, 2014, 01:34 AM
That doesn't look like the rotation axis. When rotating about an axis, all point on the axis remain in the same location.
April 9th, 2014, 01:29 AM
Is there an RSS feed to get notifications?
What kind of platform do you want to run on?
April 7th, 2014, 08:55 AM
You could always call the algorithm with a pair of boost::zip_iterators. You'll need to write a custom (or generic reusable) comparator though, which is not so nice without having support for generic...
April 5th, 2014, 12:54 PM
In C++ I would recommend using this instead:
template<typename T, size_t N>
It's much harder to use incorrectly.
April 2nd, 2014, 04:35 AM
Yes, it's a possible way to tackle the problem. You can model the problem as a longest path problem by representing each (unique) input string as a node in the graph and adding edges between any pair...
April 1st, 2014, 01:35 PM
That doesn't seem like an exact definition of the solution. You'll need to define formally what you mean with "longest possible runs". Is a solution with three runs of length 8, 5, 3 better or worse...
April 1st, 2014, 03:33 AM
There is always std::make_pair(...) to prevent some repetition.
I think in this case overload resolution would pick the non-template overload, so it would pick the (key_type, mapped_type)...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.