« first day (1682 days earlier)      last day (3270 days later) » 

Ell
5:00 PM
You could also do two for one less layer of quicksort
 
you mean random access?
 
yes
 
Fuck Cersei Lanister! Yes!
Finally.
 
No spoilers pls.
 
Ell
@wilx NO SPOILERS!
 
5:01 PM
This is not a spoiler.
 
Ell
Ahh I can't forget that
I know something will happen now :(
 
@Ell Well, something happens every episode.
 
Ell
True :)
 
@Jefffrey Why not replace your detail::partition with std::partition? Also std::prev(pivot).
 
@wilx This one is though (click at your own risk).
 
5:02 PM
@Jefffrey :D
 
I finished season 2 of GoT
 
@milleniumbug I didn't know std::partition existed. I should have guessed it though.
 
@Jefffrey why does it make a difference?
 
@AndyProwl Because then middle2 is not simply middle1 + 1, and you need the two calls indeed.
 
@Jefffrey std::next(middle1) won't do?
 
5:05 PM
Maybe it does.
Then why two calls to std::partition?
 
I don't know I suck at algorithms
 
Let's test it out
 
Oh, they choose specific pivot.
Algorithms 101:
Choosing first element as a pivot makes quicksort O(n^2) for already sorted inputs.
 
I don't understand
how does that answer the question "why two calls to partition()"?
 
It does.
 
5:11 PM
Q: "how?" A: "yes"
The pivot is chosen in auto pivot = *std::next(first, std::distance(first,last)/2);
 
Yes.
 
I still don't understand why two calls to partition()
shit it's past 7 already
and I'm the only idiot in the office
 
hello
 
It's caused by quicksort2. If you comment out those two calls, the segmentation fault does not appear.
std::partition returns the past the end of the first range
So quicksort2(first, middle); should be well formed and quicksort2(std::next(middle), last); should be too. Unless middle is end.
I guess that's is.
 
I still don't get it
 
5:17 PM
std::partition does not check wether begin == end.
It assumes there's at least 1 element in the range.
 
yeah but there's if(first == last) return;
also I'd expect this would do but doesn't:
quicksort2(first, middle);
quicksort2(middle, last);
 
right
@AndyProwl That would lead to infinite recursion.
You are not ignoring the pivot, which you should.
 
@AndyProwl hehe you're an idiot
 
lol I do feel like one
 
what the fuck
 
5:22 PM
I can't algorithms
2
 
niebler's ranges are great
 
lol, if you uncomment line 33 (print range) you get an infinite recursion, but if you comment it out it's segmentation fault
 
I made dinner!
 
I'm out.
 
@BartekBanachewicz is it an exciting dinner
 
5:24 PM
@Prismatic dunno. It's Łazanki
I don't know the english name
 
sounds spooky
 
it fails for one element lists
 
translates as noodles, and technially..
 
ranges*
 
> Noodles with sauerkraut and mushrooms
kinda this
and meat ofc
 
5:26 PM
Pictures look p hype
Reminds me of mushroom ravioli a little bit
 
@AndyProwl It doesn't change anything semantic-wise. It does performance-wise.
You want your two divided ranges to be of similar size.
 
Jeff's version segfaults so unless he fucked up somehow it does change something semantic-wise
 
Ell
I want to make a full English breakfast machine
 
the problem is that less-or-equal comparison is used so in some cases the recursion is called in the same sequence.
 
@Ell They already exist: go into any German Hotel breakfast bar.
 
Ell
5:31 PM
Cool
 
"Taxi for Mr McClaren"
 
imagine {1,1} we pick '1' so we split into {1,1} and {}
 
@Ell It's weird - the Brits are all eating ham, pickles, cheese, croissants, the Germans are wolfing down sausages, bacon, beans, eggs, toast etc.
 
@AndyProwl Stack overflow
 
@MartinJames man breakfast with beans is so weird
I don't know what I was expecting but they just literally spoon beans right on your plate
 
5:33 PM
@Prismatic Sometimes, the krauts have grilled tomatoes instead:)
 
Ell
Beans are great with breakfast
I love a full English
 
My fav breakfast is defo french toast with maple syrup and fruits
 
@milleniumbug For public shame? :D Hell no
 
@AndyProwl No, his segfault is caused by stack overflow
Exactly like @Veritas said
it chooses the specific subsequence
 
it always happens for one element sequences :P
 
5:36 PM
so god like
I also really like spinach omelettes or fritattas with hash
unf
 
@Prismatic it's a very basic food. Tier 1. But tasty and filling and dirt cheap
also breaking news my own GF landed a job as a Graphic Designer Intern
so she's kinda official(tm) now I guess
 
congrats to her
 
Ell
Nice
 
tell her to design an official logo for the lounge
 
we already have a logo right
 
Ell
5:40 PM
I want to make cheese blintzes
 
also ask her why all graphic designers use stupid thin fonts id like to know
 
Ell
The existing logo is really good
Who made it?
 
Jeffff IIRC
 
those couch cushions look like a moustache
 
we held a competition
@Prismatic yeah everyone saw that
 
5:41 PM
it is pretty great tho
 
so
do we want next game jam?
 
@milleniumbug how does that differ from jeff's version?
I'm going nuts
 
It doesn't.
I'm debug printing.
 
oh
but it doesn't segfault
 
5:46 PM
It does, at the end of the 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
 
what 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ok tell you what never mind let's not investigate my stupidity any further
2
it's humiliating :D
 
You're probably just tired.
 
that's not an excuse
I mean this is 101
 
It is when you're not sleeping enough
 
nah, I've slept enough
it's just being bad at brain
 
5:49 PM
1 55 12 23 123 -387 0 23
1 0 -387
123 12 55 23
1 0 -387
123 12 55 23 0 0 132033 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
the output, and the zeroes are out-of-range, not sure why now
 
I don't so those 0s on coliru output you posted
 
But out-of-range is not why it segfaults in Jefff's code.
Jefff's code splits sequence into two subsequences.
1 0 -387 and 123 12 55 23
 
yeah I get that there will be infinite recursion e.g. if the pivot is the biggest number
 
Now the code then segfaults on recursion on the left side.
 
cause then middle will be the same as last
 
5:53 PM
hm so my internet connection delivers steady 12MB/s
fine I guess
but I kinda miss the 250Mbps right now
oh well it already dl'ed it's now patching
nevermind
 
ok, time to go home I guess
 
user1804599
goodbye andy
 
cheers
 
user1804599
Prandy Owl
 
wait I wonder if I could conquer the starboard by writing more messages about how dumb I am
 
5:56 PM
Yay. Upgraded my laptop screen to 1080p. There's so much space below starred messages now...
 
@AndyProwl Self-deprecation always works.
 
yeah, plus Puppy's around so double chance
 
user1804599
puppy is dumber than you are
 
In other news, I hate dealing with laptop screen screws, lol
 
lol, poor him
all right I'm off, cya later
 
5:58 PM
@Griwes I feel bad for IT guys
laptops are some of the crappiest assembled things ever
 
Mine definitely is, after I disassembled and reassembled it several times now.
:D
 
Gotta love that feeling of dread when you've reassembled everything and there's a screw left over
 
Yeah :D
 
@Prismatic just one? lucky :D
 
@Prismatic It's useful to have a few assorted screws of various sizes around in a desk drawer. When you see someone taking a desktop/laptop apart, you can distract them and add a few extra screws to the piles.
11
 
6:07 PM
@MartinJames hail satan
that's pure evil lol
 
hehe..
 
@MartinJames That's just sadistic dude.
 
@Puppy I find it so difficult to refrain from giggling:)
If you think laptops are bad, ever tried disassembling/reassembling a desktop display screen?
 
It seems I'm the only person walking around with a towel.
 
@R.MartinhoFernandes On your head?
 
6:16 PM
Nah. Just hanging over my shoulder.
It's Towel Day.
 
> Towel Day is celebrated every year on 25 May as a tribute to the author Douglas Adams by his fans.[1] On this day, fans carry a towel with them, as described in Adams' The Hitchhiker's Guide to the Galaxy, to demonstrate their appreciation for the books and the author.
I've never read Hitchhiker's Guide to the Galaxy
My old room mate used to rave about it though
 
I'll get around to it one of these days
 
@AndyProwl if you guys are debugging that, also note that you're making unnecessary copies of the pivots.
...which isn't super trivial to work around
 
Imma taking a towel down to the club with me.
 
6:25 PM
Can someone link me / tell me the difference between:
`std::unique_ptr<Foo> foo(new Foo(1));` and
`std::unique_ptr<Foo> foo = std::make_unique<Foo>(1);`
 
@mash Firstly, you avoid having new in your code, which enables you to make a simple test for quality: if there's no new, you're good :P
 
@mash the second one makes a temporary, move assigns, then deletes the temporary.
 
@Martin :D
 
@mash Secondly, you avoid exception unsafety if you have more than one std::unique_ptr<Foo>(new Foo) as a subexpression.
 
@R.MartinhoFernandes I'll try and get a pic/selfie :)
 
Ell
6:28 PM
auto foo = std::make_unique<Foo>(1);
^this is the best way, right?
 
@mash In addition to what @milleniumbug said, make_unique can't be used to create objects with protected or private constructors
 
So can't std::unique_ptr<Foo> foo(new Foo(1));
 
@milleniumbug You can from within a friendly context
But with make_unique you need to make make_unique a friend function
Which is... probably not a good idea? I dunno, it feels wrong anyway
 
Yes, it can, in the right context.
 
But basically it does the same right? It'll still free for me in the first one. Furthermore from what @MooingDuck explained the second one sounds a little like overkill. So what would be the best practice? (Since I cant use the first one.)
 
6:31 PM
@Martin i.imgur.com/gI6b2Dw.jpg towel, Skyrim T-shirt, twisty puzzle: clearly a geek.
 
@mash Prefer the second one (make_unique) unless you have some specific reason to use the first version
 
this-^
 
@mash seriously guys.
 
@R.MartinhoFernandes Yeah - stay away from him:)
 
@R.MartinhoFernandes we need a better pic of that curious puzzle thing
 
6:33 PM
It's exception safety.
All you mentioned are indeed differences, but the answer to the question is "exception safety".
 
6 mins ago, by milleniumbug
@mash Secondly, you avoid exception unsafety if you have more than one std::unique_ptr<Foo>(new Foo) as a subexpression.
 
given bool left, right; the expression left < right evaluates to true only when left is false and right is true, right?
 
@caps Please don't obfuscate code, thank you very much.
 
why would you use greater than / less than with bools
 
@Prismatic They're members of a struct that I am overloading operator< for.
 
6:35 PM
@Prismatic Clarity/self-documentation?
 
@Prismatic it's a spherical Megaminx.
 
@caps Yes.
 
@Prismatic Hey! You edittedtted itt.
 
So if my T* t pointer allocated 28 bytes to memory for one object, then ++t's address increases by 28 hexadecimal units?
 
@MartinJames yeah, had a brain fart :p
 
6:37 PM
@milleniumbug I thought so, thanks.
 
@caps auto tied() const { return std::tie(/* ... */); } bool operator<(const T& left, const T& right) { return left.tied() < right.tied(); }
 
@Prismatic ^
Wait. Wrong link.
 
@R.MartinhoFernandes You’re a mega minx!
 
@DonLarynx Ummm... what?
 
To be as good at c++ as robot do I need to stop cutting my hair
 
6:39 PM
@Prismatic Not if it will get caught in your bike chain, no.
 
how many lines of code can one fit into a big post without feeling bad for the readers of said post? That is the question.
 
@MartinJames Let t be an iterator. T* t = new T; ++t; so now t points to *t's address + *t's size in hexadecimals (0x0000028) for example
 
have we found the quicksort problem?
 
ah I now see why the two calls are needed
 
6:40 PM
@Prismatic ^
 
@DonLarynx Ummm maybe, but what is there?
 
That thing looks crazy
 
@Prismatic Rubik's football.
 
@MartinJames for ListIterator::operator++() all I see in my book for its implementation is this-> operator++() so thats why I asked
 
It's one of my favorites
 
6:41 PM
Why not just say ++this
 
++(*this)
 
But that increments the object
 
It's the same
 
OK, for the first time in, like, 35 years, I'm confused by indirection:)
 
@FilipRosĂŠen-refp Better question is how many you really need to make your point. I'd tend to worry that feeling obliged to include a questionable amount of code tends to indicate that I haven't explained that code as well as I should.
 
6:43 PM
the partition isn't stable so by calling quicksort on {std::next(middle), end} we don't necessarily skip the pivot but whatever happens to be at the beginning of the range at that time.
 
@DonLarynx one does not simply ++ this
 
@R.MartinhoFernandes I meant to say ++(*this) increments the dereferenced object, not the object's address (thats what ++this does)
@melak47 but syntactically this-> operator++() and ++this are the same
Not trolling, srs.
 
This this stuff is making me feel queasy.
 
@DonLarynx I'm sorry Don, I'm afraid you can't do that.
 
My std::sort call does not seem to be working.
 
6:46 PM
@DonLarynx No.
 
@DonLarynx Not trolling, but mistaken. Keep in mind that this is a pointer. ++this attempts to increment that pointer (impossible, because this is basically a const pointer. Keep in mind that a->b translates to (*a).b, and you'll see that two aren't equivalent at all.
 
@DonLarynx uh...??
 
@DonLarynx As I said, this->operator++() and ++(*this) are the same.
 
Ell
@DonLarynx ++this preicrements the this pointer
 
@melak47 I've been pretty well at that point throughout Don's '++this' thread.
 
6:48 PM
I've overloaded my operator< so that the first thing it does is if(left.name < right.name) return true but then in my list with multiple items with names "aardvark'"and several with names like "factory" I am getting results like aardvark, factory, aardvark, aardvark...
 
@Ell it would if it worked, but it doesn't :p
 
Ell
Why doesn't it?
Well
this is const isn't it?
Or special somehow
 
can't even const_cast it! :D
(I should try on MSVC before I say that...)
 
@caps Is that the only comparison in your operator<, and are you sorting the right range?
 
@Ell It's an rvalue.
It's not const.
 
6:50 PM
@Ell it's magic
 
@Ell Well, it better not start moving around on my systems:)
 
Ell
I see
 
@MooingDuck There are other members, so there are other comparisons, but I would think the name comparison being first would be enough to get them to sort by name correctly.
 
now that we have lambdas, is there any reason to use bind?
 
Ell
I don't think so
 
6:51 PM
@caps then your comparison is incorrect. If right.name<left.name, then you're ignoring the name.
 
this-> operator++() and ++this are not the same. I see now.
 
@caps use if(left.name!=right.name) return left.name<right.name; and it does what you want.
@caps you only want to fall to the other members if the names are equal
 
@Prismatic It's actually quite simple. More or less like a Cube with a few extra faces. I solve it from Cube principles. It does look fucking awesome, though.
 
@MooingDuck Interesting. Do I need to do that with every member?
 
@caps all but the last. For the last, simply don't put the if statement there.
 
6:52 PM
I'm pretty sure that ++this' would make go and hide under the bathroom sink.
 
@MooingDuck Okay, thanks. That's enlightening. So the last looks like what I originally had? Just an if(left < right) return true;
@MooingDuck Oh, that would make sense too. I was having the last line be return false;
 
of course I spoke to soon...
 
@melak47 Should be true though--in particular, ++ (at least normally) applies to an lvalue, but this is a prvalue. It's a little like the name of an array--each signifies a value of the right type to assign to a pointer, but neither is a pointer itself. Trying to increment either one would be about like trying to increment 7.
 
@melak47 undefined behavior
 
I wonder what happens when the destructor is not trivial :v
 
6:54 PM
@melak47 probably nothing, internally, this is probably passed by value, so doesn't affect outside stack
 
> const_cast
panic
 
@MooingDuck yeah, destructor has the correct this again. aw.
 
I want one of those bright red panic buttons but it has the words 'undefined behavior' on it
 
@JerryCoffin this is the draft-implementation of a "meta container" (usage can be seen here), the "problem" is that the implementation makes use of some meta-template programming (to power up the push/pop/set members) - do you think I need to include both in the post itself, or can I just link to the latter implementation (as well as the counter implementation)?
 
Const cast removes constness @Prismatic
 
6:56 PM
@DonLarynx I'm aware
 
@DonLarynx and in 99% of uses, is used to perform undefined behavior
 
@JerryCoffin the theory behind the meta container's different parts has already been explained in detail (in the post together with previous ones), but the readers probably expect some code thrown into the mix
 
Hi @MooingDuck
 
@Prismatic Now I want one too
 
@JerryCoffin in total it's about 165 lines of code for the two, 210 counting the counter implementation. I mean, it's kind of a lot - but at the same time, it's not that much code
 
6:59 PM
@MooingDuck Er, no.
It's perfectly fine.
The cast is an identity cast.
 

« first day (1682 days earlier)      last day (3270 days later) »