Type: Posts; User: monarch_dodra
Search took 0.12 seconds.
January 23rd, 2015, 12:17 PM
Be careful. This is probably not what you wanted. I believe what you wanted here was to do a "specialization"? This is not what you did. What you did was declare a template parameterized on *a*...
January 16th, 2015, 04:26 PM
Actually, that's a good point. I forgot about that. That means that my_map.end() is always valid *for a given map*, regardless of what you do to that map.
I would also guess that that kind of also...
January 16th, 2015, 11:39 AM
Sounds like a good plan actually :)
January 16th, 2015, 10:20 AM
Hum... I'd have suggested "optns.end()" instead... ?
Although if you do modify optns, then later, your piter might not compare with .end()
I'd have suggested simply "OPTITER()", but depending...
January 10th, 2015, 03:11 AM
I'm pretty sure there is also a big implication on compilation times...
January 5th, 2015, 09:38 AM
Generate 3 random numbers between 0 and 191, and flip those bits?
Just make sure you don't generate the same number twice: Either re-roll when it happens, or try a random shuffle.
January 5th, 2015, 09:32 AM
To add to that, I'd add an abstract class called "Player", which would have different implementations, such as "HumanPlayer" "DumbAI" "SmartAI" etc...
A Game would be made of 2 Players and a...
December 18th, 2014, 04:49 AM
My first comment is: "I know it's easier using std::list but we were asked to implement the projet using our own home-made List class, so we learn how to do it." I don't see a home made list class...
December 17th, 2014, 10:00 AM
Should your nodes hold the number information in some place? Or is the idea that the node's index in its container makes that implicit?
In any case, to insert a word, I'd decompose it into its...
December 17th, 2014, 08:37 AM
Ideally, I think you should store your names in an (unordered_)set. A set is a data structure that manages its own ordering, and is itself capable of retrieving items for you, and knowing if they are...
December 17th, 2014, 06:42 AM
You need to read what you just wrote. Which variable are you using to iterate?
December 17th, 2014, 06:14 AM
Please properly format your code. I don't see any "search name" function. What exactly isn't working for you?
This declares a variable length array and is not standard C++. Use an std::vector...
December 16th, 2014, 04:06 AM
I remember this question with the actual "design requirements" which would have better helped answer. As is, we can only guess from the names what the functions should do. My guess is:
December 14th, 2014, 05:23 AM
There is a version of find called "find_if" that can take a predicate, and will return an iterator to the first element for which pred(e) returns true.
If you do a functor approach (with state!),...
December 12th, 2014, 10:13 AM
BTW, month names in English are capitalized.
December 12th, 2014, 09:51 AM
First thing: If you want some real help, please take the time to format your code into something easy to read. We are giving you free help. If you can't make the effort, then you we might not feel...
December 11th, 2014, 04:19 AM
It means that *IF* your object is declared in a name space *THEN* your "operator<" *SHOULD* be in the same namespace. This is for Koenig lookup, but you shouldn't have to worry (or even know...
December 10th, 2014, 04:30 AM
As laserlight said, you can either define operator< in result_holder for a "default" sort. If you want to customize the sort, you can do it either via a function pointer or functor.
if you want to...
December 9th, 2014, 03:25 AM
I'm a bit rusty on my linear algebra, but it seems you are basically just trying to find the basis of your matrix? Aren't there known algorithms that do that already?
December 8th, 2014, 10:46 AM
I think he wants to process sequence of partial permutations?
December 8th, 2014, 04:04 AM
Well, depending on how you look at it, he's only *swapping* items in and out, but never actually doing insertions or deletions. Given OP (seems) to be working with trivial ints, then sticking with...
December 8th, 2014, 03:58 AM
Yes, I hesitated to mention this. But to be frank, I think that's a bit over OP's level...
December 6th, 2014, 04:38 PM
For what it's worth, if this is a class assignment (and it looks like it is) that requires a recursive solution, then a simple "check first, recurse the rest" might not be what is being asked of you....
December 5th, 2014, 11:32 AM
It's just shorthand: a reference is (mostly) just a "dereferenced pointer" managed by the compiler. You are reinterpreting the reference, which is equivqlent to extracting a reference (pointer),...
December 5th, 2014, 09:31 AM
You are "C casting" your long long back to a double "(double)piAsLong". This is a standard value-style static_cast: You are literally reading the numeric value of your long (f1d4c853fb210940), and...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.