I want to sort a string using sort algorithm in c++.
Is there any advantage of doing this:
str.sort(str.rend(),str.rbegin())
over this:
str.sort(str.begin(),str.end())
like class x { template<class T> T* function() {return new T;} } you have to put a specialization for that outside the class not inside it like so template<> derp* x::function() { return new derp; }
@R.MartinhoFernandes No, the number of types is not bounded. But, for one of the types that is commonly used (Matrix), it has a problem where the implicit conversion operator for the Matrix's operator= gives it a number of possiblities (float[16], or another Matrix). The way to solve this is to give either an explicit function that converts down to a Matrix or have an explicit template instantiation for Matrix.
The latter fails, for some reason I can't figure out. Maybe because the explicit template instantiation is weighed the same as the non-explicit-template instantiations when being considered for use with operator= on the Matrix.
The other possibility is to just do a static_cast and be done with it, but that feels sticky.
Ooh, damnit
Explicit functions fail too.
q_q, why you so mean to me ADL.
Welp.
view = static_cast<Matrix>( modelshader->Paremters["View"] ); it is!
Why am i getting a error when i try to static cast a element* to an int
typedef Element* ElementPtr
int Element::getVP (ElementPtr item)
{
return static_cast <int>(item); // I have a class called Element
}
@Abyx I'm trying to read from a pipe to a child process's stdout an stderr in the "busy-loop" in order to prevent hangs when the output of the child is too much for Windows' pipe buffering.
I prefer CoffeeScript because it has switch/if/for/while expressions, list comprehensions, ranges, indentation rather than semicolons, classes and => and no more ==.
@Abyx Currently, I'm using CreateProcess, followed by a GetExitCodeProcess loop checking for STILL_ACTIVE. After this exits, I'm using ReadFile to read all the contents of the pipes. If the child outputs a shitload of data to the pipe, my parent process freezes waiting for the frozen child to exit. (shitload being a realistic compiler error of about 138kB.
IMO, it should be written like this:
create process
thread t1([]{ read until EOF from pipe1 });
thread t2([]{ read until EOF from pipe2 });
WaitForSingleObject(hProcess);
t1.join();
t2.join();
@LightnessRacesinOrbit Did you swallow an anti-joke-cat? I'm pretty sure you know that Win32 API doesn't support Peep shows. Or at least, not in the documented interface
Windows 8, for example, can be upgraded to Windows 7. And Windows 7 can be upgraded to <insert Linux distro here>, which can be upgraded to Arch Linux.
Hey ho. So did that fix your problem. LOL That was an hilarious typo. It was so glaringly obvious, that our temporarily resident punctuation fetishist managed to completely miss it :) (eeeck)
@Zoidberg If they're unused, just unmapping them seems a hell of a lot more effective. IMO: Swap is death to your system. If you need swap, game over already. (Of course, on my smallest VPS-es I run with swap, just in case...)
In a para: a qualified-id with a nested-name-specifier which contains a class-name that names a dependent type -> class-name must be template-id , right?