Type: Posts; User: superbonzo
Search took 0.05 seconds.
uhm, unless I'm missing something, no, because a reference to an automatic const int is not a constant expression ( triggering an implicit capture and hence an error ). Are you using a c++14 standard...
AFAIK, clang is right because const int's ( and unscoped enumerations ) initialized by a constant expression are like constant expressions themselves when converted to rvalues ( eg. if no address is...
February 4th, 2016, 03:45 AM
off the top of my head, this should work ( and works on clang ), although it may not be very portable due to compilers idiosyncrasies concerning virtual member pointers ...
January 29th, 2016, 10:47 AM
BTW, looking at the posted link, that emplace() call does look somewhat brittle, but for a different reason; that is, it's currently unspecifed whether the moved object is actually moved or not if...
January 29th, 2016, 10:36 AM
no, it can't ( assuming cmp a unique_ptr ). emplace() takes both its arguments by reference perfect-forwarding them to the corresponding std:: pair constructor. So, indpendently of evaluation order,...
January 12th, 2016, 04:22 AM
indeed, according to this ( as of now, accepted ) standard proposal due for c++17, order of evaluation will be fixed for postfix and assignment expressions ( but note that this won't affect the OP...
January 12th, 2016, 03:41 AM
this doesn't make much sense to me; if your proposed language change aims at forcing the compiler to detect ALL such cases, then this is and always will be impossible in c++ ( consider an expression...
January 11th, 2016, 09:49 AM
this is impossible, generally speaking. Trivial cases aside ( that are already signaled by compilers like clang ), the compiler cannot statically check all such cases due to aliasing issues.
January 4th, 2016, 04:17 AM
first of all, you're using the user defined literal facility the other way around people would usually expect, that is, you write -20kel to actually mean -20 degrees celsius ...
second, the '-' is...
December 29th, 2015, 04:03 AM
yep, map::at returns a reference to the element associated to the given key, or throws if none exists ( this is in contrast with operator that creates a new element in this case ).
December 22nd, 2015, 10:09 AM
just for clarity sake, it's worth noting that this can happen because cout's operator<<(int) takes its parameter by value, and parameter initialization is a part of parameter evaluation, so to speak....
December 8th, 2015, 03:09 AM
indeed, int main() is so special that the language specifically allows omitting its return value, that in turn is simply assumed zero.
December 5th, 2015, 12:44 PM
I'd still check if the 'problem' is just a matter of textual output.
I mean, unless the OP has expectations that go beyond what floating point has to offer ( like making assumptions about the...
December 5th, 2015, 04:42 AM
it's not "wrong", you just need to make sure that the set is not empty ( so that begin() is dereferenceable ) and that the pointed to object remains valid, that is until the set erases it.
December 4th, 2015, 10:45 AM
I mean, in order to increment a binary number in natural order you only need to search the first least significant zero bit, say, in 101010111 you check and flip only the first four bits on the right...
December 4th, 2015, 09:00 AM
maybe it's just a textual output problem, have you tried printing total_cost with more digits ?
December 4th, 2015, 04:31 AM
now, ignoring your very personal definition of bigO ...
are you claiming that the number of output.replace() calls grows as N*2^N in the regular case and as 2^N in the Gray case ? this is also...
December 4th, 2015, 03:20 AM
as a side note, you're probably using a non-standard implementation of std::thread here ( maybe, vs2013 implemented an early draft ? ) because destroying a detached std::thread will invoke...
December 4th, 2015, 03:11 AM
I doubt so, unless your real intent was to allocate memory for nops parseNode's for constructing nops parseNode pointers ... does not make much sense to me
December 3rd, 2015, 05:43 AM
for( int c = 0; c < N; ++c )
December 3rd, 2015, 05:03 AM
the fact that you're changing just one bit does not mean you do it in O(1), you still need a time proportional to the number of max bits in a way or the other...
December 3rd, 2015, 03:21 AM
as far as I can tell, I see three problems:
1-if nops is negative you may end up allocating a lot of unused memory
2-if nops is zero it may cause a "FatalError" or maybe not, it's implementation...
November 30th, 2015, 10:22 AM
here is the corresponding library defect issue
anyway, note that O(n) "sorted insertions" are still guaranteed at container construction...
November 14th, 2015, 04:11 AM
... uhm, why ? unless accessing the map by row/col is too costly for some reason ( you didn't show your "map" definition ), it's easy to enumerate a vertex neighbour, just lookup what's at...
November 10th, 2015, 03:52 AM
design issues aside, note that you cannot generally control globals initialization order across translation units; this means that if your globals depends on each other ( even after main() started )...
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!