« first day (920 days earlier)      last day (4034 days later) » 

7:00 AM
You can type "." and get the members too.
 
@Drise ... quicksort, bloddy quicksort, right? Wikipedia would seem plenty informative
 
@Rapptz Well, using "get" tends to filter out all the private memebers and functions
 
@Drise contrast recursively
@Rapptz Dat
 
@sehe Yea, and so would like 4 SO QA's
One would think though.
I think I've botched the conversion from arrays to vectors
 
Xeo
+6/-4 now
 
7:03 AM
3
Q: C++ quick sort algorithm

RoRI'm not looking to copy a qsort algorithm. I'm practicing writing qsort and this is what I've come up with and I'm interested in what part of my code is wrong. Please don't tell me that this is homework cause I could just use the code in the link below. Reference: http://xoax.net/comp/sci/algor...

 
@Mysticial that comment was hilarious .. and ironic (meeeeeooooowwww)
 
Ell
@drise you are writing quick sort, yes? Do you have to write an iterative version or can it be recursive?
 
If that cat starts moderating, we'll know it is one of Anna's. — Bart 59 secs ago
^^ brilliant
 
@Ell Doesnt matter; I'm doing the recursive version
 
Well it's gone
 
7:07 AM
Aww, Gordon destroyed the user.
 
Ell
Meh I have to go to school now. But I think ima write a version when I get home
 
damn it!
 
Xeo
Noooo~
 
Gordon hate cats, we hate Gordon should be the new topic
 
Maybe I'm just being thick, and maybe I used a fucked up algorithm solution to start with
 
7:09 AM
@refp +1000
 
Xeo
@Mysticial I hope he prepares a fitting answer to my question.
 
@EtiennedeMartel Hurry up and get Dark Souls so you can play with Cat and I <33
 
@sehe Erm, that was my point: to have a markup on Stack Overflow to be able to overlay code, rather than posting either (a) comments in code or (b) a picture with annotations
this is all of 1–4 in your list
And you do realise that this suggestion was firmly tongue in cheek?
 
fuck it
im just gonna bubble sort
 
@Ell Iterative quicksort? Uhm.
 
7:16 AM
@Drise What's your issue?
 
@Rapptz I want to quicksort a vector
 
Hm..
 
Xeo
@Mysticial: Your edit gave me a new silly idea for a question on MSO...
 
lol, my quicksort function should just be a call to std::sort
 
@KonradRudolph You had a very confusing way of making your point, then :)
 
7:17 AM
that would win me superpoints
 
@KonradRudolph Nope. I have left my detector on the charging station since it came in late last night
 
@sehe Why? I clearly mentioned markup, and then I posted a mockup (which, obviously, is an image since I didn’t want to implement such a major feature myself, just for a joke)
 
@Xeo oh?
 
@KonradRudolph And the mockup shows... Image markup. Lo and behold, people might think you mean image markup
 
Xeo
"Why are pictures not worth a thousand words on SO?" - because you added a picture, and it just said "150some characters added", which is clearly not a thousand words.
 
7:18 AM
And of course, other kinds of markup would still... suck rather badly.
If anything, code snippets with line numbering and attached comments could work. A bit
 
@sehe Well yeah I realise. But my original post mentioned “a markup for overlays over code
@sehe Interesting; why do you think so?
 
Yup./ Still: you assume everyone will think of "text markup" (?! whatever that would look like) instead of image markup. I don't follow (hint: this is your assumption, and it clearly doesn't hold for everyone)
 
of course you get problems as soon as the overlay overlaps with other stuff
 
@KonradRudolph ^
 
7:21 AM
lol, where is @mooingduck when you need him
 
So. Now we have mods coming in to drop OT vid oneboxes :/
 
@Gordon do you really think that is going to solve anything?
 
@Drise You still haven't posted the relevant code
 
@refp yes
 
DO YOU REALLY BELIEVE THAT WHAT YOU DID CAN BE JUSTIFIED BY LINKING A VIDEO WHERE THE THUMBNAIL IS A CAT?
@Gordon oh, alright. proceed.
 
7:21 AM
@sehe Okay, different priors, I agree. I was thinking of the way websites currently start to do stuff, i.e. JavaScript all the things and use canvas / HTML markup instead of generated images
 
26 mins ago, by Drise
https://ideone.com/B6S5gc
 
Xeo
@sehe Haha
 
modified from
 
@Drise the relevant code
 
19 mins ago, by Drise
3
Q: C++ quick sort algorithm

RoRI'm not looking to copy a qsort algorithm. I'm practicing writing qsort and this is what I've come up with and I'm interested in what part of my code is wrong. Please don't tell me that this is homework cause I could just use the code in the link below. Reference: http://xoax.net/comp/sci/algor...

 
7:22 AM
@Drise Ah looking over there. Nah. Same code.
20 mins ago, by Drise
I think I've botched the conversion from arrays to vectors
^ I'm not looking at your quicksort as long as this could still be the culprit and it isn't even shown
 
Xeo
12 mins ago, by Xeo
@Mysticial I hope he prepares a fitting answer to my question.
 
@sehe It sorts, sure, but it never terminates. It always opens a left>right branch each time once sorted
 
@Drise So, you know the problem :<
 
@sehe Yea, but I'm just changing little things without understanding the underlying issue.
Essentially I'm just guessing
 
mawning fellas
0
Q: How can bounds-checking be extended to multiple dimensions?

CTMacUserThis is an extension of one of my previous posts. I made a container class based on that answer: template < typename T, unsigned N0, unsigned ...N > struct array_md { // There's a class template specialization with no extents. // Imagine the various N... components are bracket-enclosed...

template wankery galore!
they still make 32bit versions of Win8?
why? I would ask, why?
 
dat pun
 
@TonyTheLion where?
 
in your comic
 
¬_¬ I know fool, I was being silly
god damn it! Lost rep to a removed user again
 
@sehe The solution: int pivot = *(begin + pivotIndex);
 
7:40 AM
@Mysticial nice to 'meet' you, first saw your name next to a huge π file that I needed some time ago, congrats for that!
I really got bashed for that post, but the incomplete badge set bothered me :P
 
@kaᵠ Oh hey.
@kaᵠ -6 isn't bad for meta. (I didn't downvote btw)
 
@Mysticial ty, i saw meta is all for dv's
 
Bad would be something like this:
-31
Q: Most recent bad behaviours of SO users I have faced

RubyLovelyI have a serious question with Stackoverflow,and I think meta is a good place to make myself correct on my confusions. As we know SO is a Q/A forum. But when I am putting questions users in a group keep continuing down-vote. After that when I did edit,no one corrected the voting.Being a question...

 
my post started with the [discussion] tag also, but got edited out, i actually want to get some info on this from the mods cuz everybody's got something to say(repwhore)
 
Or this:
-90
Q: Evaluating the risks of allowing teen moderators on the SE network

user774411I have a David vs Goliath case here involving a teen moderator on Stack Overflow. His display name is BoltClock. I'm a low reputation SO user (less than 150 points) who was recently suspended for Voting Irregularities by BoltClock. Eventually the mistake was corrected by another non-teen moderat...

 
7:46 AM
wish i could +1 the first answer here ^
 
Well shit, can it not handle non-unique elements?
fuck me
 
Need a max age of 30, don't trust nobody over 30
 
:)
age is of no importance, way of thinking things is
 
Xeo
The answer in question is not covered by that though. The question was on-topic while the answer was just noise. Since the user has no other worthwhile answers, I assume it was created solely for adding that answer. Hence I destroyed it. — Gordon 24 mins ago
Murderer. :(
 
lol
 
7:50 AM
@ThePhD Reminds me of this.
But in your code you capture the promise (which is a local variable) by reference.
That might not be a good idea :)
 
Xeo
@Gordon: Make that an answer so I can properly downvote you for killing an innocent kitten! — Xeo 7 secs ago
@Mysticial ^ :)
 
@StackedCrooked I have to write my own concurrent_bounded_queue I think, because I don't have TBB or PPL or whatever that other stuff is.
 
@Xeo that cat wasn't a cat actually. It was a dog posing as a cat to slander the beauty, grace and undisputable loveliness of the feline species. — Gordon 50 secs ago
 
@Drise make it *std::next(begin, pivotIndex) for flexibility. But props for sticking to it, and solving it yourself. You have earned the badge
 
@sehe Well, now it won't handle duplicate elements
 
8:02 AM
:) It didn't handle those before either
 
Probably not
Any tips?
 
@Xeo I can't see why the comment invocation wouldn't SFINAE as I intended: coliru.stacked-crooked.com/…
@Drise Moar debugging :)
 
Butr it's 3 am :/
 
Yeah. So, moar debugging tomorrow?
 
@sehe At first glance boost::range_value is not SFINAE friendly.
 
Xeo
8:06 AM
@sehe The error doesn't happen in the immediate context, it happens somewhere deep inside of boost::range_value
 
@Xeo sorry, I meant to /ask/ whether you know why that is
 
> // 2. dereference a nullptr pointer and pass it as reference
lol
1
Q: Are nullptr references undefined behaviour in C++?

hydeThe following code fools around with nullptr pointer and reference: #include <cstdio> void printRefAddr(int &ref) { printf("printAddr %p\n", &ref); } int main() { int *ip = nullptr; int &ir = *ip; // 1. get address of nullptr reference printf("ip=%p &ir=%p\n", ip, &ir)...

 
@Xeo Ah. Can you tell I don't really like TMP
 
And now I'm segfaulting in random stl headers
I think I've corrupted my stack :/
 
@LucDanton How would one (try to) make it more SFINAE friendly?
Would template aliases help? (I reckon: no)
 
8:09 AM
@sehe Good guess.
 
@Drise So check for end iterators better. Perhaps pivotIndex is getting out of bounds
 
Whoa. Looking
 
Xeo
Also, y u insist that they are exactly the same value? :)
 
yay for shit sorts
 
8:11 AM
bin user
 
@Xeo Assignable would be okay-ish
@LucDanton Mmm. modulo the typo that demonstrates the same problem, right?
 
@sehe I don't see no typo.
 
@LucDanton s/usin\>/using/ - it's unimportant (unless it means you copy/pasted an older version :/)
 
Oo yeah that one.
 
8:16 AM
@Xeo Yay. Workiness. Lemme see how it does it
 
@sehe Or I'm just 65000 function calls deep. That might corrupt some shit too
 
is there a O(n) sorting algo ? or what's the fastest?
 
quantum bogosort - O(1)
 
Xeo
@sehe Note that I took the "assignable" literally.
 
lol, ok something else?:)))
 
8:18 AM
@kaᵠ There exists an O(1) sorting algorithm. It's called "Meh.. it's probably fine as it is already" algorithm
It only works if the passed array is already sorted though
 
@Xeo Yay for paranoia (what if range_value<C>::operator= returned a type that has overloaded operator, ... Sure :))
 
I dont want to give up on this quicksort, but its 3:15am, and bubble sort looks so inviting
 
@Neil indeed :) i use that all the time (after i make sure the precondition is true)
 
@Xeo Yeah, I see. That's also much easier, I guess. What if I wanted to keep the std::is_same? Is it trivial?
 
@kaᵠ I actually do think O(n) is possible with a qbit array, but that's a bit over my head, and most computers aren't equipped with their own personal quantum cpu
 
Xeo
8:20 AM
@sehe :3
 
@Drise Post the darn code on coliru :/
 
Otherwise, the best possible sort time is O(nlogn)
 
@Neil that's why i'm asking, i think O(n) is achievable, just wondering what's the best out there, or what's the most fesable one
 
Xeo
@sehe Unqualified<decltype(*begin(c))>(*begin(r)), but I was too lazy to add Unqualified.
Oh, wait is_*same*? Why'd you want that? :)
 
Just... for the exercise.
 
Xeo
8:21 AM
is_convertible should be what you want, likely.
 
@kaᵠ That's the point, O(n) is not achievable without some prior knowledge on the state of the array
 
okay, five days of Scottish lochs for me :)
off to Argyll, see you guys
 
Xeo
Have fun!
 
oh I will – to the extent possible within the confines of a lab retreat
 
@sehe FTR convertible and emplace constructible seem to be the corresponding reqs on insert, sole value and range versions respectively.
 
8:23 AM
I think there are quantum cpu emulators out there that will do it in O(n) time (emulated of course)
 
@Xeo All depends on how generic it should be allowed to behave, right. Granted, I might have just taken concat(C c, C const &other) but I wanted to be able to pass make_iterator_range(a,b) as well
 
Kinda surprised by the emplace construction here tbh.
Of course can't go wrong with conversion.
 
Sounds a bit cynical, really
 
Oh boy, I think 'EmplaceConstructible into X' means 'Constructible + uses_allocator construction'.
 
@Neil prior knowledge meaning... types/lengths/min/max/array_length ?
 
8:25 AM
@kaᵠ Prior knowledge, as in, "Sort this array from lowest to highest knowing that the array is already sorted from highest to lowest"
You could make a O(n) sort algorithm which reverses the order of the array
 
@Xeo Anyways, how would I use a trait in decltype abuse context? I fear we'd be back at square 1: the range traits not being SFINAE friendly?
 
oh, that's a special case @Neil
 
@kaᵠ That's prior knowledge :P
You usually don't work with prior knowledge though
 
@sehe No, you're back at using my SFINAE goodness!
 
usually
 
8:27 AM
You're given an array and you know nothing about it other than each object contained corresponds to a comparable value
 
complete and compilable
 
@LucDanton Cough. It didn't really work. Did I miss something? coliru.stacked-crooked.com/…
 
Hell, it's not even sorting it nwo
how bloody hard is it to write quicksort?
There's no way it's as hard as I'm making it
 
just do a monte carlo bubble sort :D
 
I gotta hand it to @StackedCrooked, coliru is pretty well done
 
8:34 AM
@Drise s/Swap/iter_swap/ ?!
 
@sehe No, it should be swapping the values
 
@Drise Precisely
Oh god. You wrote your own Swap
 
@sehe But it does
 
^^
Why
 
I think I'm just going to stop programming for a few months
I feel incredibly stupid right now, and dont even know why
 
8:35 AM
@sehe It's too early for this shit.
If it helps grep RangeValue returns no hit, so that may be telling.
 
It is. For me at least :) However, now is the opportunity, so I'm going to keep at it
 
@sehe I dont even know what I've done wrong. From what I can tell, it swaps values, not pointers
 
@Drise Like std::iter_swap?
 
@Borgleader Light leakage is associated with visibility blocking geometry, so it's a question of non-shadowing lights (you basically refrain from calculating shadows on most deferred lights so you suffer some leakage because their occluders are not taken into account). But most importantly, light leakage in their solution is due to the Dachsbacher-Kaplanyan lattice-based diffuse global illumination which isn't really precise. For simpler lighting models, you don't have to worry about that too much.
 
8:37 AM
@Drise You wrote code that exists. Also, why not std::swap(*begin, *end) in case you didn't know about iter_swap
 
@LucDanton I..... I guess?
@sehe Because I'm being dumb this morning.
 
@Drise it's a symptom of learning. Now you know why
@Drise Join the club :)
 
so what, iter_swap lets me hand it iterators, and it swaps values?
 
Possibly. I've never used the thing.
 
@brief Swaps the contents of two iterators.
Comments say so
@param a An iterator.
* @param b Another iterator
lol "another iterator"
 
8:41 AM
does the standard mandate a particular implementation for std::hash?
 
@Drise Yes.
26
A: What's the point of iter_swap?

seheFrom the SGI docs (here): [1] Strictly speaking, iter_swap is redundant. It exists only for technical reasons: in some circumstances, some compilers have difficulty performing the type deduction required to interpret swap(*a, *b).

@TonyTheLion no (except maybe for int)
 
Can anyone give me a reason as to why they hate Java? Other than no type inference.
 
Xeo
@Mysticial: My silly pet question is already at +19... :D
 
@Xeo That's old for a cat
@GamesBrainiac because it's ugly, verbose, crippled with bad APIs and a pattern-poisoned community
(I like don't hate java)
 
@sehe wow. All those reasons in one sentence. You should write a programming language! :P
 
8:44 AM
@GamesBrainiac Yeah. And it would be a lot terser than... java! (Or C++, for that matter)
 
1
Q: SFINAE and order of definition

manuConsider this simple SFINAE test to determine if a type can be an argument to std::begin #include <utility> template <class T> constexpr auto std_begin_callable (T const*) -> decltype (std::begin (std::declval <T>()), bool ()) { return true; } template <class> constexpr bool std_begi...

 
C++ has other strong points (such as, keeping my brains occupied)
 
@sehe brains
 
I shall confess my ignorance here
 
@sehe Honestly, I hate debugging C++
 
8:44 AM
@Xeo: Is that UB? (in the linked question)
 
It annoys the crap out of me.
 
@GamesBrainiac That's why you don't write bugs :/ True though. Debugging hurts. But it's not much better in other languages, in my experience
 
Damn, I don't feel so good. Damn sleeping.
 
@sehe Debugging in Java and Python is much better. In Python it works like a charm.
 
@GamesBrainiac Well, it works in C++ too. Like a charm? Come on. I have better things to do with my time :)
 
Xeo
8:46 AM
@AndyProwl Whaaaat. First of all, begin and end are defined in iterator. Next, <array> doesn't have any specialization of those two, the ones that forward to member begin/end suffice completely. Also, you can't partially specialize function templates, so it'd never work for std::array anyways.
 
@Xeo OK. Though, he's not partially specializing, or is he?
 
@sehe Actually in Python you barely ever need to de-bug
cuz its awsum! :D
 
Xeo
> Note that the array header, in which the specialization for std::begin is defined
 
And the more i learn haskell
the more i like it
 
Xeo
I was calling out this ^ bullshit
 
8:48 AM
@Xeo Oh, all right
 
In the case that it were overloaded though you wouldn't get UB -- the overload wouldn't be found unless the calls were made unqualified so that ADL would kick in.
 
Xeo
Okay, converted into comment
 
@Xeo Thank you for clarifying. So provided he includes the correct header (<iterator>), can the header be #included after the function template definition and before the static assert?
 
@Felics to be perfectly blunt, the strict answer would be: "that's implementation defined" - the standard doesn't specify how std::function is to be implemented, or, for that matter the return type of std::bind. So if you really wanted to know how it is implemented, go to your implementation. I thought you were asking about it conceptually, and I think I answered that. — sehe 50 secs ago
@GamesBrainiac That's my point. Debugging hurts
 
@AndyProwl Declaration is all that matters.
 
8:50 AM
@sehe Most with C++, heck it has two +s to illustrate the point! :P
 
@sehe I appreciate the help and encouragement, however, I must be heading to bed soon. Birds are beginning to chirp. Am I doomed to bubble sort or?
 
@sehe But besides that, what do you mean by a pattern-poisoned community?
 
@LucDanton Not sure I understand. Do you mean the header should be included before those function templates?
 
If it's not there, then the qualified call is an error. If it's there, then it works. If call is unqualified, ADL kicks in for std::array.
 
@Drise Your doomed to sleep. And tomorrow, you'd start afresh. And ace it.
 
8:51 AM
@AndyProwl 'Can't have call to std::begin without a declaration' is the short version.
 
@sehe I wanted to turn it in tonight :/
 
@GamesBrainiac A flock of developers who value cargo cult programming more than they know
@Drise You can
 
@sehe But it's straight borked
 
@LucDanton Oh, right, I see
Thank you
 
@Drise That's another matter. This is just my response to your "but this... ", "but that... " -> unconstructive.
 
8:52 AM
@sehe Wow. That was a really big insult, and I had to google to understand what the heck it was! :P
 
@sehe Fair enough.
 
@GamesBrainiac Hah. It's not meant to insult you, by the way. You can judge whether it applies (it applies to me as well, you know)
 
@sehe You're a flock?
 
@sehe Not me man, to Java.
:P
 
@GamesBrainiac Thing is, the popular java libraries are literally crowded with patterns for the sake of patterns, and "OO" (runtime polymorphism) for the sake of OO
 
8:55 AM
@sehe So, its just design for the sake of design, that serves no purpose.
That what you're saying?
 
Well, the wrong design :)
 
@sehe : How would you make a TRIE data structure avoiding pointers?
 
@sehe AbstractSingletonProxyFactoryBean has to be one of the better examples I've seen
 
Xeo
0
A: Understanding std::function and std::bind

XeoIf you don't use argument placeholders (_1, _2, ...), then any arguments passed to the funtion object returned from std::bind will just be discarded. With: std::function<void(int)> f = std::bind(fun, std::placeholders::_1); I get a (long and ugly) error as expected.

Kekeke
 

« first day (920 days earlier)      last day (4034 days later) »