« first day (848 days earlier)      last day (4097 days later) » 

10:06 AM
0
Q: std::sort in c++?

ofeyI 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())

 
Cannot template specialize in current scope.
 
I like the casual troll.
 
Yeah
But he edited it.
I was going to answer and be nice.
 
@H2CO3 I thought you were kidding around with OP but str doesn't have a sort method. — Rapptz 17 secs ago
@ThePhD Your answer is wrong, std::string doesn't have a sort method. Fix it.
Or you'll get downvoted
 
Fixed
@___@
So fast
 
10:12 AM
He edited his question, now he wants to sort a vector of ints...
 
lol another dumb OP, what a surprise.
 
WTF
This guy
 
Its actually hilarious, everyone fell for the string sorting because he called a vector<int> str
 
His original question was about strings.
OP's just dumb.
 
Damn.
Well
Another 0 point answer for me. ;~;
@Rapptz But look! I have 6 answers now! :D
 
10:17 AM
I'd upvote but your example is terrible.
 
How is it terrible? D:
 
abcd?!
what happened to e?
 
=l
 
lol
 
E is for EVERYONE HATES RAPPTZ
 
10:23 AM
little harsh
 
by the way the reverse iterators would actually crash your program so
maybe add a blurb saying it's UB or it crashes your program, whatever you want
 
OH MY GOD LOOK AT HOW SYMMETRICAL MY SCORE IS NOW
111
I'll stay like this forever. <3
111 4lyfe.
 
@ThePhD It's just as symmetrical as it was before.
 
hi robot
 
user1357851
@ThePhD Gosh it is as low as mine, thought mine is really bad
 
10:27 AM
Well, you could say I like keeping...
Sunglasses.
a Low Profile.
 
I should downvote you.
 
=[[[[
Don't do it. D:
 
user1357851
Someone needs to downvote me 10 times to kick me off this chat now :D
 
Sorry, we love you too much.
 
Alternatively, we don't and also don't care.
 
10:31 AM
If I have a templated implicit conversion in a header file, where do I specify the specialized versions of such a conversion?
In the implementation file, or the header?
 
@ThePhD Same rules as a non-templated function I think.
 
Oh.
... Well, it's not letting me do either. :D
 
Then you have another problem.
 
Whats the error you're getting?
 
error C3412: 'Furrovine::Graphics::Shading::ShaderParameter::operator Furrovine::Matrix' : cannot specialize template in current scope
I have the template specialization in both the header and the implementation file.
 
10:33 AM
you'll have to specialize it outside the class
 
Are you trying to specialize in class scope?
 
in the header file
 
.... Oooh.
..... Wait
INSIDE the header file, OUTSIDE the implementation file, OUTSIDE of the class definition?
... Whoever made this rule for C++ is going to get a bat from me to their kneecaps whenever I can make it to an isocpp meeting.
 
@ThePhD wait you separated a template class to .cpp and .h?
 
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; }
 
10:35 AM
Not derp* x::function() ?
@Rapptz The class isn't templated, just a function.
 
yeah derp* x::fnc
 
Hm. Well, when I do it this way now, the overload resolution fails and it can't find the function.
Man, I hate you, C++. Die in a fire. =[
 
whoa whoa whoa
calm down lad :P
 
maybe if I just don't make it a template specialization but just have the function there explicitly.
Perhaps that would be better, even though a template instantiation could collide with the explicit functions I'm going to write...
.... Oh whatever, who cares.
 
paste the .h file on pastebin.ca or something
 
10:40 AM
Wait, are you trying to say that the number of possible types is bounded?
 
@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!
 
0
Q: Cant static cast class to integer

ComputernerdWhy 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 }

coincidentally lol
 
Ooh!
Maybe I could try to answer this one!
... But the OP is pretty lost...
 
lol I think OP has other issues than his static cast not working
 
Whoa, even leppie showed up.
 
10:55 AM
what the hell is he doing casting from a element* to int
 
@AndreiTita That's not the same issue, but I understand what you're showing. Thank you though.
@EdwardA I think he wants the pointer value.
Or rather, the Integral Address Value.
 
user142019
Hi.
 
hi
@ThePhD Why do you have operator= to a float[16]?
 
user142019
Whatsup.
 
user142019
11:01 AM
@DeadMG Because he sucks.
 
Hiiiyooo
@Zoidberg What he said /cc @DeadMG .
 
just get rid of it and problem solved
 
Not quite, unfortunately.
 
user142019
C-style arrays are bad and if you use them you should feel bad.
 
@ThePhD why not?
 
user142019
11:02 AM
They have the weirdest semantics ever.
 
user142019
You cannot copy them and they implicitly decay to damn pointers.
 
TMatrix4<T>& operator= ( const RMatrix4<T>&right ); <-- This one is also an overload and is necessary, as its the base class of TMatrix4<T>
There's 3 collisions, the float[16], the RMatrix4<float> and the actual Matrix (which is just TMatrix4<float>)
Removing the other two would mean I can't interop with the base class anymore.
 
why does the matrix template decay to a float[16]?
that's just anal.
 
user142019
Make your conversion operators and single-argument ctors explicit you noob.
 
It... doesn't?
Maybe it does. Um. Let's find out.
 
user142019
11:05 AM
Also use std::array<T, N> instead of T[N].
 
@Zoidberg Is there really a difference?
 
user142019
Yes. std::array behaves decently.
 
user142019
You can actually pass it around without problems, it has readable syntax, can be copied and whatnot.
 
Hm.
operator T* () const; <--- the monster in the closet?
 
Good point, passing C arrays as parameters kind of sucks.
 
user142019
11:08 AM
@ThePhD make it explicit operator std::array<T, 16>() const.
 
where'd the 16 come from
 
user142019
Or if you don't want to copy anything, explicit operator std::array<T, 16> const&() const.
 
anyone here a hero in CreatePipe/STILL_ACTIVE/ReadFile?
 
magic numbers are bad.
 
user142019
But conversion operator to reference seems kinda weird. xD
 
11:09 AM
@Zoidberg Why? it's the correct way to handle this.
 
Blaarrgh.
Explicit operator breaks shit x-X
Or breaks the upwards conversion, anyhow.
 
user142019
Yes and you should fix the things that broke.
 
user142019
Implicit conversions are bad.
 
user142019
Use Haskell where this shit doesn't exist.
 
Haskell will solve my problems?
 
11:10 AM
Implicit conversions are awesome. Don't use Haskell.
 
user142019
It has no C-style arrays and no implicit conversions.
 
user142019
All problems solved. It's wonderful.
 
Puff, the Magic Haskell.
 
@rubenvb wut?
 
I wrote in Haskell today.
 
11:11 AM
@Rapptz wash your hands
 
@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.
 
user142019
I love Haskell.
 
user142019
It's one of the few good languages.
 
How did you rate js?
 
11:15 AM
the weird part is it seems I can read from the stdout_handle but not the stderr_handle, and I set them up in the exact same way.
 
@rubenvb ...and? btw, there is popen for it
 
user142019
@JohanLarsson Between C# and C++ I believe.
 
js<C# I hope
 
I gave up on Haskell when they started to talk about indian food.
 
@Abyx nope, popen is not good enough for me.
 
user142019
11:16 AM
I prefer CoffeeScript because it has switch/if/for/while expressions, list comprehensions, ranges, indentation rather than semicolons, classes and => and no more ==.
 
I have Win32 code for Windows and fork/exec/wait for unix.
And I doubt popen solves OS buffering issues
 
user142019
@JohanLarsson yes.
 
@rubenvb which issues?
 
user142019
Oh also string interpolation.
 
I don't love js thus far, wtf @ console.log() being my only debugging friend
 
user142019
11:19 AM
@AndreiTita currying is feasy.
 
user142019
f a b c d is just the same as ((((f a) b) c) d). It's like reversed Lisp!
 
user142019
Functions always take exactly one argument.
 
@Zoidberg But how could I work with a language that makes me hungry all the time?
 
user142019
And can return a new function.
 
user142019
@AndreiTita eat more.
 
11:21 AM
The moment of truth...!
TITTIES it FAILED.
 
@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.
 
I did everything you guys said and it still fails to resolve the proper overload. =[[[[[[[
Alll my teaarrzzz.
 
user142019
Implicit currying is something I miss so fucking much in other languages. :|
 
@rubenvb o_O
 
It's either hanging on the busy loop or on the ReadFile.
 
11:23 AM
@ThePhD what errors are you still encountering?
 
@EdwardA Overload resolution failure. That is, only one; operator= is ambigious (on Matrix)
 
@EdwardA 'TITTIES', clearly
 
@Zoidberg Haskell is not for me, though. I just don't see the point in having all those restrictions.
 
@sehe of course
 
Hmm, I just found PeekNamedPipe
 
@sehe I wish my errors were Titties. :c
 
I've never seen a regular question turn into Community Wiki so quickly
 
@ThePhD So you can suck on your errors?
 
@sehe Delicious FailMilk: Nutrition for Losers.
 
@sehe Yum.
 
user142019
11:26 AM
@AndreiTita more difficult to write bad code that does bad things.
 
Apt
Rpm
Pacman
Npm
Ipk
 
user142019
npm is the best.
 
pacman ftw
 
@rubenvb IMO while (ReadFile(...)) ...; should be enough
 
Npm?
 
11:27 AM
@ThePhD back on topic for a second, you should really paste the header file somewhere, theres no way to help without seeing the actual code
 
@Abyx the ReadFile is blocking the program.
 
@EdwardA Nah, I know what the problem is and I've just decided I will accept my static_cast.
 
@rubenvb run it in a separate thread then.
 
Really, what I'm fighting for now is syntactic sugar, not even functionality.
I've pretty much won the battle.
 
@sbi Sign Of Life: ACK
 
11:28 AM
@Abyx uh, no. And it would still block, cause the main program would wait for the thread.
 
^ do we know which user was deleted?
 
you!
 
@rubenvb show all the code)
 
I'm trying a PeepNamedPipe call before the ReadFile. MSDN says it also works on unnamed pipes.
 
11:34 AM
omg
 
@sehe Removing a users costs only 10 rep? That's awesome! I'd love to remove a bunch.
 
@StackedCrooked haha. I hoped it's be someone we knew
 
@Abyx What? It's straight up Win32 using C++.
 
I wonder if they are also removed irl.
 
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();
 
11:37 AM
@rubenvb I'm trying real hard to work out why you edited PeepNamedPipe into PeepNamedPipe there
 
@sehe no idea. I think it's a chat artifact.
 
@sehe what? he didn't
 
That must be it
 
Because PeepNamedPipe is wrong and PeepNamedPipe is right.
 
@Abyx why on earth do I need a thread there? The parent will wait for it to finish regardless of extra threads.
 
11:38 AM
"unnamed piped" => "unnamed pipes"
 
It's actually Pee**k**NamedPipe
 
why call GetExitCodeProcess in a loop anyway %) use WaitForSingleObject
 
"PeepNamedPipe" has nothing to do with it so what are you on about
 
@LightnessRacesinOrbit He clearly did. Watch closely, how the following letters were swapped [P]eepNamed[P]ipe
 
@Abyx both are quite equivalent in result. And because Google told me.
 
11:39 AM
o.O
 
@rubenvb meh
 
I thought it was P[e][e]pNamedPipe.
 
@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
 
oh, I see now - your screenshot was incomplete. You didn't post the "current version" bit.
 
I hope I'll never maintain your codes =\
 
11:40 AM
@LightnessRacesinOrbit Irrelevant. My screenshot was complete, the last edit is the current version
 
WinAPI is breaking standards by requiring peeping through pipes instead of holes.
 
So what? Your humor failed :)
 
@Abyx Classic Sleep() design fail..
 
Then I once more have no idea what the fuck you're going on about
There is no humour here
 
@LightnessRacesinOrbit So much is apparent, commiserations
 
11:41 AM
o.O
I have no idea why you edited "So" to "So", there
must be a - no, wait, this is not funny in any way
 
It's a so so joke.
 
@MartinJames explain. I'm missing something here.
 
@LightnessRacesinOrbit Is there some other mistake in So I completely missed?
 
That's more like it
 
user142019
One problem of Arch Linux is that it's impossible to upgrade.
 
11:43 AM
@Zoidberg Impossibru?
 
@Zoidberg bs.
 
user142019
Well, until there is a new version of Arch Linux.
 
user142019
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.
 
user142019
>:D
 
@rubenvb Windows synchro API knowledge - Abyx should explain.
 
11:45 AM
@Abyx Please explain my apparent cockup.
 
TESTS PASSED!
 
For what it's worth, PeekNamedPipe before ReadFile inside the "busy loop" resolves my program blocking.
 
@ThePhD You had exams?
 
No the tests for my shader stuff.
THE CUBE HAS RETURNED
 
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)
 
11:48 AM
@ThePhD So you're involved in a shady business..
 
@sehe are you on drugs?
 
@rubenvb Pun and humour drugs far beyond your meta.
 
user142019
I want 4 TB SSD.
 
user142019
I'd make 1 TB swap.
 
Every time again you guys baffle me.
 
11:50 AM
@StackedCrooked A shady business, indeed. I might even start to diffuse the water a little bit. :D
 
The new iMacs come with hybrid SSD/magnetic drives.
 
magnetic drives
sounds like a rail gun.
now to do something similar for Unix...
 
user142019
@StackedCrooked just give me SSD.
 
user142019
I don't want no HDD.
 
user142019
I prefer 2 SSD over 1 SSD + 1 HDD.
 
11:52 AM
why not a RAM drive for swapping?
 
user142019
@JohanLarsson lol
 
@ThePhD Nah. That's my regular cruising altitude /cc @rubenvb
 
user142019
You know what swapping is?
 
user142019
It means moving unused pages from RAM to disk and back.
 
@Zoidberg But 4 TB SSD will be expensive.
 
11:53 AM
Death
 
user142019
@StackedCrooked //care
 
user142019
Time is also expensive. So don't use an HDD.
 
@Zoidberg no probably not, some sex thing I guess?
 
user142019
@JohanLarsson I was talking about page swapping, not cum swapping.
 
@Zoidberg How will you get the money? Are you dealing drugs or something?
 
user142019
11:54 AM
@StackedCrooked I don't know.
 
user142019
I'll wait till they become cheap-ass.
 
@Zoidberg I can page someone to swap cum
 
@Zoidberg but then a RAM drive would be optimal no? (I have never used one)
 
@StackedCrooked He'll finish one of his projects and make millions of Zoidberg dollars.
 
user142019
256GB SSD is 200 EUR.
 
user142019
11:55 AM
You know, four of them is enough.
 
user142019
@JohanLarsson no. You don't want to swap to RAM.
 
user142019
Swapping is to allow for a ginourmous address space.
 
You should be able to disable swap if you have plenty of RAM.
 
user142019
And if you have 4 GB RAM, and swap to RAM, you have 4 GB address space at best.
 
@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...)
 
11:56 AM
@Zoidberg get a ginormous amount of ram and don't swap
 
how much RAM do you have and how much do you need?
 
@Zoidberg Haha. You missed the irony bit
 
RAM is cheaper than SSD.
 
user142019
I have 1 GB RAM and I need 1 GB RAM. In a VM.
 
@rubenvb And faster
 
11:56 AM
yup
 
user142019
I want infinite capacity drive.
 
user142019
There should be a brain drive.
 
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?
 
user142019
Brains are fast.
 
user142019
11:58 AM
And have ginormous capacity.
 
@Zoidberg their speed is still mostly mystical.
The raw neuron speed is abysmal, but the network of neurons is blaizingly fast.
 
user142019
How can I determine whether an SSD is good or shit?
 
user142019
I'm terrible when it comes to hardware.
 
@LightnessRacesinOrbit nice
 
@Zoidberg Read the specs
 
user142019
11:59 AM
When are the specs good?
 

« first day (848 days earlier)      last day (4097 days later) »