Click here to Skip to main content
14,836,050 members

Comments by CubbiMew (Top 10 by date)

CubbiMew 25-Mar-15 22:11pm View
So you're not actually looking for array rvalues? If I understood the actual problem, you just need to write a function template overload for std::initializer_lists, and have it call your pointer-taking function template with the result of calling begin on its parameter.
CubbiMew 7-Mar-15 14:59pm View
I am not answering the question title, I am answering the question content.
CubbiMew 23-Jan-15 11:43am View
No, it most certainly does not work as you described, except on a few very specific compiler/platform combinations (the ones I know of are the Windows runtime and the Solaris libc). Note that, with C, "works for me" is not an argument; writing past the end of an array might "work" too.

I filed a bug report against the linux man pages, by the way (the Linux fflush undoes the read buffering when reading a file (as required by POSIX), but does nothing when reading a terminal. The man page only mentions the file input)
CubbiMew 23-Jan-15 10:02am View
No. #1 describes the library glibc as found on Linux and does not actually discuss fflush(stdin), which does exactly nothing on that platform. #3 describes Microsoft runtime, which, as I already mentioned, is about as useful as clrscr from conio.h.
CubbiMew 23-Jan-15 8:02am View
#1 and #3 do not describe C. #2 incorrectly claims that the behavior for input streams is implementation-defined (it is actually undefined, the difference is significant), but at least it attempts to save face by mentioning this so-called flushing and adding "this is not portable expected behavior".
CubbiMew 23-Jan-15 6:33am View
Documentation for what exactly? If it claims to be documenting C, it is a lie. It is likely documenting some non-portable extension, like Microsoft's fflush, which is about as useful as clrscr.
CubbiMew 22-Jan-15 5:59am View
No, where did you get this idea?
CubbiMew 15-Oct-14 0:07am View
There is nothing special about array serialization, it just works: see boost.serialization tutorial[^]

Your code works pretty much as-is in GCC:[^]

How exactly does it not work for you? Is there a compile-time error? Can you post it?
CubbiMew 14-Oct-14 20:23pm View
Surely: std::equal(s.begin(), s.begin() + s.size()/2, s.rbegin())
CubbiMew 14-Oct-14 20:11pm View
It's even sweeter if you realize that this loop can be done with a single call to std::equal