« first day (874 days earlier)      last day (4083 days later) » 

9:01 AM
also, if they want me based on the tutorials I've written, it's time to upload some of the ones I've finished but got laying around on my hard drive.
 
WOW
> You can store any data in a shared_ptr<void>, and still have the correct destructor called at the end, because the shared_ptr constructor is a function template, and will use the type of the actual object passed for creating the deleter by default:
TIL.
 
Xeo
"template<class T> class Singleton;" -- you're bad and you should feel bad. Print all lines of your code with the word "singleton" in it and burn them. — Xeo 8 secs ago
@BartekBanachewicz Haha, the reaction is always awesome when people first learn that..
 
@Xeo Can't wait to show it to C fanatics on uni
oh my god
 
type erasure is useful for shared_ptr.
 
> I was wondering if this could be done by pre-processor macros:
 
9:04 AM
they have to allocate for control block anyway.
 
i guess it might really help with dealing with crappy C codez
 
Xeo
@BartekBanachewicz Also, I knew I recognised that quote from somewhere.
Turns out it was from an answer to my type-erasure question. :P
 
@Xeo oh, right, of course. I upvoted it.
 
@BartekBanachewicz where is that from?
 
@bamboon look 2 lines above -.-
 
Xeo
9:07 AM
44
Q: Type erasure techniques

Xeo(With type erasure, I mean hiding some or all of the type information regarding a class, somewhat like Boost.Any.) I want to get a hold of type erasure techniques, while also sharing those, which I know of. My hope is kinda to find some crazy technique that somebody thought of in his/her darkest ...

 
$ grep -Rli singleton . | xargs shredR. Martinho Fernandes 8 secs ago
 
Xeo
haha
 
> Any ideas on how I can accomplish this so that the Sub class is not aware of inheriting from a Singleton<template> class?
 
@Xeo thanks
 
he should be shot for that quote
twice.
 
user142019
9:11 AM
CRTP is basic.
 
I'm happy to see that my intense hatred of singletons is shared by people a lot smarter than me ;-) — MadKeithV 4 mins ago
 
user142019
I think OP is curious about CRTP.
 
@Zoidberg hiding the inheritance from singleton.
 
Morning nubs.
 
haha, referring to the puppy.
 
user142019
9:12 AM
Closed as Too Much Singleton.
 
I'm sorry, I didn't see it says "Apple's codebase" in the name of the chatroom. y so many singletons, then? :P
 
user142019
AbstractSingletonProxyFactoryBean
 
Xeo
@DomagojPandža You're a singleton, shaddup.
 
We're all Singletons on the inside.
 
@Zoidberg CRTP is basic?
 
9:14 AM
well, it isn't very hard
that's what she didn't say
 
user142019
What else is it?
 
user142019
It's not complicated.
 
@bamboon I don't see much of a difficulty to it
 
it's not hard to implement. It's about as complex as recursion I think... though perhaps tricky to see the point of it
 
9:15 AM
Wait, how did people filter a container before copy_if?
 
@R.MartinhoFernandes for (...) if () copy;
 
The Legends Football League (LFL) is a women's 7-on-7 tackle American football league, created in 2009, with games played in the fall and winter at NBA, NFL, NHL and MLS arenas and stadiums. The league was founded by Mitch Mortaza as the Lingerie Football League, and was rebranded as the Legends Football League in 2013. The league's administrative offices are in Las Vegas, Nevada. Concept The concept originated from the Super Bowl halftime alternative television special called the Lingerie Bowl, a pay-per-view event broadcast annually opposite the Super Bowl halftime show. Playing styl...
 
@R.MartinhoFernandes boost range stuff?
 
@tony ^ found your sport!
 
How'd you get that from the wiki article I linked?
 
9:17 AM
I knew this existed, funnily enough
but thanks for reminding me :)P
 
Xeo
@R.MartinhoFernandes remove_copy_if with inverted predicate
 
@Rapptz your man helped manage it
 
off to work
 
@Xeo Ugh, I won't dare use that naked.
Woah, that came out wrong.
 
9:18 AM
@BartekBanachewicz ?
 
> After retiring from wrestling, Rodman became Commissioner of the Lingerie Football League in 2005.
 
I should probably go.
 
@Xeo Hmmm, that needs wrapping, otherwise is potentially harder to read than the explicit loop.
 
@thecoshman Ah.
I was reading the North Korea tidbit.
 
@thecoshman The what.
 
Xeo
9:19 AM
@R.MartinhoFernandes Or.. just implement copy_if properly :P
It's 4 lines or what
 
@R.MartinhoFernandes ¬_¬ scroll up dude, it got renames the Legends FL
@Rapptz have you seen the interview where he is talking about that?
 
template<typename InputIterator, typename OutputIterator, typename Predicate>
OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
{
    for ( ; first != last; ++first )
        if (p(*first))
            *result++ = first;
    return result;
}
why not use that one?
 
Xeo
2 mins ago, by Xeo
@R.MartinhoFernandes Or.. just implement copy_if properly :P
 
@thecoshman I was reading about it
 
Xeo
Also, there's a dereference missing there.
 
9:21 AM
brothers = parent()->leafs();
    std::vector<node*> other_brothers;
    std::remove_copy_if(brothers.begin(), brothers.end(), std::back_inserter(other_brothers), _1 == this);
 
@Xeo That's not my code. That's Boost's.
 
This simple thing is not compiling for ` _1 == this`
 
set_list(list, set);
 
Xeo
*result++ = first; ==> *result++ = *first
 
English can get tricky.
 
9:22 AM
brothers = parent()->leafs();
std::vector<node*> other_brothers;
std::remove_copy_if(brothers.begin(), brothers.end(), std::back_inserter(other_brothers), _1 == this);
 
Xeo
@Rapptz Wait, that's not from the actual Boost header, right?
 
I found it in the maintainer's svn trunk
 
Xeo
Erm
 
Xeo
@Rapptz Erm.... Woa
 
9:25 AM
Why does back_insert_iterator<Container>& back_insert_iterator::operator* return *this instead of the type you're inserting?
oh wait
because otherwise you couldn't write to it?
 
Xeo
Well, you'd have to insert a default-constructed type first and then assign it.
And that's bad.
So it does the push_back inside of operator=.
 
Anyway off to bed I go.
 
Xeo
@Rapptz Okay, the code was actually like that in 1.51.0, but it is fixed in 1.53.0
 
lol
 
Xeo
9:28 AM
I'm a bit shocked, tbh
 
the one in cppreference is fine!
template<class InputIt, class OutputIt, class UnaryPredicate>
OutputIt copy_if(InputIt first, InputIt last,
                 OutputIt d_first, UnaryPredicate pred)
{
    while (first != last) {
        if(pred(*first))
            *d_first++ = *first;
         first++;
    }
    return d_first;
}
remove_copy_if is a terrible name..
 
@Xeo I'm not sure I understand the badness of it?
 
Xeo
@TonyTheLion Not every type is default constructible.
@Rapptz Not really, if you think about it
 
Could have been better.
 
@Xeo ah right
 
9:33 AM
@Rapptz I liked it. Just the fact that copy_if was missing irked me more
 
Xeo
Well, there is remove_if, which modifies the sequence in-place. remove_copy_if copies the removed elements to a new sequence, instead.
 
@Xeo Nah, really, especially if you think about it.
@Xeo Except it doesn't remove anything at all, it just copies.
 
Heh, look what cppreference says that std::back_insert_iterator<Container>& back_insert_iterator::operator* does. Huh what?
 
always thought that was the bad.
 
Xeo
There's also replace vs replace_copy, reverse vs reverse_copy, rotate vs rotate_copy and others.
 
9:35 AM
copy_if_not or copy_except are two other names I've seen that sound better
 
@TonyTheLion It means that *it = expr; calls push_back(expr).
 
@DeadMG but it says it does nothing
I'm lost
 
Xeo
@TonyTheLion Yes, the dereference itself does nothing
 
operator* does nothing.
if you do *it then what is it supposed to push_back.
 
Xeo
The = part of the expression does the push_back.
 
9:36 AM
It says "remove_copy", but it's just a "copy".
 
as in, it doesn't actually derefence
@Xeo which is operator=?
 
Xeo
Yes
 
And "remove copy if" doesn't even work as English (at least not with "copy" as a verb).
 
ah ok, now I get it
thanks :)
 
There's really nothing that makes sense in that name.
 
9:37 AM
kill it with fire
 
Xeo
There's all sorts of algorithms with a _copy infix/suffix which, instead of modifying the original range, output to a new range instead.
 
how can I close stackoverflow account ??
 
Xeo
@R.MartinhoFernandes Nvm, I misremembered, it copies all elements over except the removed ones.
 
Does anyone know how to take over an existing ssh session? There's a gdb running on pts/5 and I'd like to obtain a terminal to it.
 
@Xeo Right, that's the point. It's just a copy with a negated predicate.
 
9:40 AM
@StackedCrooked I think it's not possible. There's a possibility of defining a "screen" to which you can come and go.
 
@StackedCrooked Do you use screen?
 
But if you didn't do it at the beginning, then no. :D
 
(If not, you should)
 
@ManofOneWay sure, go ahead. :) And yeah, I understand completely. Your thesis did sound cool
 
Xeo
Well, they had to choose a name for the non-inplace algorithms, and I think copy isn't that bad.
 
9:40 AM
The bad is the remove_, not the _copy.
 
@R.MartinhoFernandes screen is not installed on that machine.
 
copy_if_not
 
@StackedCrooked Then that's beyond my knowledge.
(Now go install screen and set it as the command to run when you ssh)
 
Thanks.
 
@DeadMG Yep, Google also found me through SO. Here's your chance!
They might make you move to the US... ahahahaha
Or work next to Jon Skeet.
 
9:44 AM
@Mysticial You don't have a puppy avatar.
 
Mysticial was recruited for the skills, not for his looks. Ahahahah :D
 
@R.MartinhoFernandes No, but I had a chick. What's better?
 
@Mysticial 10 billion digits of pi
 
In C++11 is double checked locking still broken?
 
Xeo
@R.MartinhoFernandes But the original algorithm is remove :s
@R.MartinhoFernandes He has anime girls, though.
 
9:46 AM
as in, it now has memory semantics that could prevent the sillyness which broke it in the first place, ie memory reordering, but not sure if that means that DCL implementations can now work reliably.
 
mornin
 
mawning
 
@Mysticial got your swag?
 
@LuchianGrigore yeah
about a month ago actually
 
1 week ago here
 
9:47 AM
Probably faster in the US.
 
should be
gotta say it's pretty cool
 
@TonyTheLion Double checked locking is probably broken in every language.
 
I left it at home though. I don't have much use for it at school. And there's no point in bringing it around if I'm gonna moving home in a couple months anyway.
 
@TonyTheLion Anyway... call_once covers most use cases of 2CL.
 
@ManofOneWay anyway, from the impression I got from the others, you are probably welcome to give us a call if you get tired of Oracle later on. :)
 
9:50 AM
@R.MartinhoFernandes This.
 
@R.MartinhoFernandes "2 centilitres..?" :(
 
(I got it now, but I was confused)
 
Xeo
Btw @Mysticial, did you watch Katanagatari yet?
 
@Xeo Not yet...
 
9:52 AM
Okay now I'm really off to sleep.
 
night
 
Xeo
g'night
@Mysticial You know what they say.
 
> StringsWrapLine.cpp(126): message: This is the default implementation which is not unicode savy and can only wrap line at specific character codes! Please add a unicode savy method using OS native calls here
 
Fun Fact: It takes almost 100 MB of bandwidth to load this bookmark.

Mobile Weaponry by Compuserve

yesterday, 1 day 5 hours total – 396 messages, 7 users, 2 stars

Bookmarked 6 hours ago by Mysticial

 
Wooo, look, a very interesting warning I can fix.
@Mysticial BOLD THAT PLEASE
 
Xeo
9:54 AM
Ahahaha
 
An pattern that I often see in our code is that a "child" object calls my_parent->remove_child(this); in its destructor. This seems wrong.
 
@StackedCrooked It makes sense if the children cannot possibly exist on their own.
 
One of our mods had the great idea of dropping it on 4chan to see what happens.
We haven't done it yet. But it'll be interesting...
 
I think I'm starting to develop a feel for cases.
Yay.
 
Xeo
@R.MartinhoFernandes Erm, why would the child remove itself from the parent, then? if it can't exist on its own, shouldn't somebody else own it?
 
9:57 AM
@Xeo Not if its lifetime is shorter than the parent.
 
Which is a given, since it would break apart if the parent died. Otherwise, it would be gone with the parent's destruction.
 
@R.MartinhoFernandes I think that if the parent owns its child objects then destruction of children should be controlled by the parent. And thus there's no need for the child to inform the parent that it's being destructed.
 
Indeed, it would be better if the parent queried the child should it exist, rather than the child telling it.
This seems so weird and morbid. :D
Damn terminology. :D
 
@StackedCrooked Who says the parent owns the child objects? It doesn't. It holds a weak reference.
 

« first day (874 days earlier)      last day (4083 days later) »