« first day (1565 days earlier)      last day (3608 days later) » 

17:04
@sehe Do you recommend the paper at all? Or were you pointing to the abstract?
user1804599
Hi.
@AlexM. @sehe it's pretty normal
AH FUCK OFF I BUILT THE WRONG CONFIGURATION
17:13
@LucDanton I was pointing at the abstract
30 minutes lost.
30 minutes of Lost.
So exploding kittens are the most backed Kickstarter project
30 lost of minutes.
@LightnessRacesinOrbit That sounds like a form of torture.
@Descrip got halfway down the image then started hunting around for the proof that the Oatmeal was involved. dat font.
@LightnessRacesinOrbit Same. Haven't read those comics for a while
@R.MartinhoFernandes idgi (google doesn't help)
My linear Diophantine solver is complete!!! Give me any three integers and I will find you a solution.
17:21
@LightnessRacesinOrbit that's p obvious really
R. Daneel Olivaw is a fictional robot created by Isaac Asimov. The "R" initial in his name stands for "Robot," a naming convention in Asimov's future society. Olivaw appears in Asimov's Robot and Foundation series, most notably in the novels The Caves of Steel, The Naked Sun, The Robots of Dawn, Robots and Empire, Prelude to Foundation, Forward the Foundation, Foundation and Earth as well as the short story "Mirror Image". He was constructed immediately prior to the age of the Settlers, and lived at least until the formation of Galaxia, thus spanning the entire history of the First Empire, the...
@EtiennedeMartel I don't usually spend that much time lost.
Ah. The R.
programming is so awesome, you get to work from home
user1804599
Peter R. de Vries.
@DonLarynx I don't
I wouldn't want to though, there's lots of shit moving around
17:28
@DonLarynx And waste time!
don't want this mess on my own PC
I have a folder called "Trash", where I put crap I don't need but don't know if I should delete.
@Nooble I knew someone who did that, but he just used the Recycle Bin and never emptied it.
I always empty my recycling bin.
I think I just deleted my dependencies folder.
:C
Now I have to compile so many things from source again.
@Nooble: Give me any three numbers.
integers*
17:37
1337, 1080, 2160
@LightnessRacesinOrbit How much is it?
^_^ @Nooble
Finding solutions to 1337x + 1080y = 2160...
A general solution to the system is
x = 762480 + 1080t
y = -943920 - 1337t
@LightnessRacesinOrbit I saw this! 0 to 60 in 3.2 sec or something
@Descrip yeah
@Nooble I can't find a price
17:40
@Nooble P85D begins at $120170 USD
That's actually really cheap for 0-60 in 3.2 seconds.
In an electric car too.
@Nooble Apparently it was also lowered by $14000
@Descrip I want one.
@Nooble Me too
I just validly used a goto.
4
17:47
I request proof.
@LightnessRacesinOrbit goto hell;
So you can't tell any human being about it?
@Nooble Nice try.
Foiled again!
17:50
@LightnessRacesinOrbit switch statement I presume? or error handling in code that had to be noexcept?
@Nooble When they made a list of who could have access to this information, you were considered but didn't koalafy
9
:P
Have they not considered the koalaty of my work?
@Nooble That's exactly what diskoalafied you.
@Mgetz The former. More or less.
Unfortunately this awesomeness has been overshadowed by the fact that I've wasted a day chasing comms/socket problems due to having listened on the wrong fucking port.
@LightnessRacesinOrbit I figured, those are the two most common scenarios where goto makes sense, in my experience.
17:54
@Nooble What do you think koalas should do to fight chlamydia?
@Descrip I find chlamydia unbearable.
euchlamydiyptus, surely
Hi Lounge
17:57
I am seeking advice about some nested class templates, if anyone likes that kind of code
@Nelxiost ...and a great booming voice from the sky says: "How dare you address me without first falling on bended knee?"
@Nelxiost I like eucalyptus.
@Nooble Unfortunately, I do not introduce eucalyptus in my code =/
@Nelxiost My advice is like the standard advice about optimization: Rule 1: Don't do it. Rule 2 (for experts only): Don't do it yet.
@JerryCoffin Well, what if you want to encapsulate your classes ?
Or is that still bad ?
17:59
@Nelxiost And what is the reason for this abomination?
@Nelxiost I do it. But I also have local types (in anynomous namespaces in the cpp)
@Nooble I do not have access to enough eucalyptus...
Carry on then.
inb4 friend ::std::make_eucalyptus
@sehe Local types ?
18:01
@Nelxiost I've described exactly what I meant
The time has come for me to make a singleton.
@sehe I don't know what anynomous is :p
How do you access types in anonymous namespaces ?
user1804599
@sehe eucalyptus isn't an STD, unlike chlamydia.
(never used anonymous namespaces, it might be time to start)
Ten minutes debugging v.insert(std::begin(v), std::begin(a), std::begin(a));. I should go home.
18:03
@Nelxiost usually understood as "having no name"
@Nelxiost But let me humour you bit.ly/1BxUuH0
user1804599
I'm absolutely puzzled.
@Nelxiost have you ever used google?
is there any reason to prefer std::begin to some_container.begin()
@Nelxiost An anonymous namespace looks like namespace { /* contents here */ }. Everything in that namespace is visible within that translation unit, but not outside it.
user1804599
Yes, in generic code if you want to allow terrible C arrays.
18:05
@AndyProwl hehe
user1804599
Otherwise, no.
@sehe I was already reading some SO post about that
user1804599
Also use ADL.
good, because that was where the first hit ends up
@рытфолд jerk
user1804599
???
18:06
@Nelxiost then that was not very appropriate
@рытфолд you're scaring the noob
user1804599
Good.
I just read what ADL is and it seems bad
@sehe Well, that was a joke (yeah right, it was bad)...
it reminds me of that thing you can do with constructors if you dont use the explicit keyword
@Nelxiost Geez. Shows how traumatized we get from too many noobs being entitled and barging in here :)
@Pris implicit conversions.
@Pris It's actually one of the best features in C++ vis. generic programming. Granted, a few "tangents" of it can be pretty surprising
user1804599
18:09
The only really bad part about ADL is that there's no fucking adl operator.
@sehe Haha maybe you should get some rest, sometimes
I should
@Nelxiost Also, it might be a good idea to not overplay your hand when you're not a regular (although I'm quite sure I've seen you here before)
@sehe I don't knwo how it would help with generic programming (seems advanced and beyond me) but i dont like anything that doesn't follow 'apparent' behaviour
Well, seems to work well, but I did a misstake : I just need to work with integer... So, well, hank you again sehe for your attention. Hope it will helps someone then ! — Marion 31 mins ago
This is also high on wtf :)
@Pris It does! Unless, of course, you want to argue that std::cout << "hello world"; is not apparent behaviour (why would that work without using std::operator<<`?)
@sehe thats adl right? i meant explicit
18:13
@рытфолд Anything starting with the precept that there's only one serious problem with ADL is clearly mistaken.
In my language I would make @begin(x) do call with ADL
@JerryCoffin There were other things, but they weren’t found during lookup.
7
@sehe Yeah I have been here before, I just don't like chatting that much (although I often come find funny things out there). Far be it from me to be arrogant.
user1804599
Best would of course be no ADL at all.
user1804599
ADL has the same problems as duck typing.
user1804599
18:17
Protocols and type classes are a much better way of doing overloading.
@sehe Alright, from what I've read, you mean that you don't write nested classes, but instead put what would be the inner classes in an anonymous namespace. Is that so ?
@Nelxiost ...or in a "detail" namespace, as in: namespace Foo { namespace detail { /* implementation details here */ } template <class T> class Bar { /* stuff that uses detail::whatever here */ }; }
@JerryCoffin Okay, thank you (and thank you sehe)
@Nelxiost I'd prefer that yes. I don't hesitate to write nested types either (notably for iterators, erasure helpers, local function objects - i.e. those that have no use outside the implementation). But having them in the class interface makes them "public interface" so if you ever change an implementation detail, it impacts every TU that includes the header
I really suck at C++
@Pris I was replying to this though
@Nooble that's a good sign
That what?
I dunno. Just a good sign :)
> You have received a 580 page fax at Wed, 28 Jan 2015 18:01:48 +0000
18:43
std::atomic<uint> i = 5; // nope!
std::atomic<uint> i; i = 5; // ok!
Yeah spammers. Seems legit
@Pris better: std::atomic<uint> i(5); // ok!
@sehe isn't that exactly the same as his first example (the nope)?
If you can observe the difference, does it still count as exactly the same?
I can observe a syntactical difference
I mean semantically the same
9
Q: Why does an in-place member initialization use a copy constructor in C++11?

abyss.7I'm a little bit confused about the following code: struct A { std::atomic<int> a = 0; }; Which gives an error: copying member subobject of type 'std::atomic' invokes deleted constructor But almost the same code does work: struct A { std::atomic<int> a = {0}; }; Okey, if the first...

@orlp Nope.
79
Q: Is there a difference in C++ between copy initialization and direct initialization?

rlbondSuppose I have this function: void my_test() { A a1 = A_factory_func(); A a2(A_factory_func()); double b1 = 0.5; double b2(0.5); A c1; A c2 = A(); A c3(A()); } In each grouping, are these statements identical? Or is there an extra (possibly optimizable) copy in so...

18:46
hmm
for some reason I thought T x = y; was the same as T x(y);
So I'm trying to make a singleton.
@orlp Read the second linked q ^
yeah I did
@orlp it can be under certain circumstances;
@Nooble Good for you. If you wanna live, don't step into the arena :)
18:48
I understand now
When the function type is a reference to a type, do I return the type or a reference to a type? Because this piece of code says I should return the type.
reference because how would you return a copy?
isnt the whole point of a singleton to prevent copies?
@Nooble You mean the function return type is a reference. And the reference is to an object :)
@sehe Right.
Damn. Edit spasms
18:52
I need a "forward_as_tuple" function, that stores rvalues in the tuple by value, does anyone know of an implementation of that?
@Pris That's what I thought but this answer on SO says otherwise.
@gnzlbg make_tuple
@sehe make tuple stores lvalue references and const lvalue references by value too, i want to store those by reference
You didn't say :)
@sehe sorry :P
18:54
std::forward_as_tuple?
Does that mean I can return an object as a reference as long as the function return type is a reference?
make a simple variadic helper that uses a simple transform (foo(T&&... a) { return forward_as_tuple(unrvalue(a)...); } -
bbl
kids 2 bed
Compiler doesn't seem to be making any complaints.
@sehe or maybe it would be easier to write a cast function, like forward and move, but that returns rvalues by copy
@sehe hah, thats what i just meant
@Nooble yeah but the object should remain valid after the function returns
18:55
@Pris It does.
What the hell why does this work.
I'm going to go ahead and ask on SO
forward/move/
- untemporify
- unrvalue
- hold ? like, you get something you can actually use without memory corruption
@Nooble then yes.

class Thing
{
    int & ping() { return pong; }
    int pong;
}
returns a reference to Thing.pong...
Xeo
Xeo
@gnzlbg as_lvalue
@Nooble The thing you're returning reference to must outlive any usages of the reference. That's why you don't return references to local variables, and other examples.
@milleniumbug It's static.
18:58
4
Q: c++11 initialization T{p, ...} vs T = {p, ...}

ThomasMcLeodIn his new book Effective Modern C++, Scott Meyers makes the statement in the section "Items 7: Distinguish between () and {} when creating objects," that: I'll generally ignore the equals-sign-plus-braces syntax, because C++ usually treats it the same as the braces-only version. Taking n...

it works, and is unsafe, so it _can_ result in undefined behavior,
but for example, when you dereference an iterator, it gives you back a reference to an object, and you can mutate it through the reference
MSan does catch errors with references to objects that result in UB, but is a pain to configure
@Xeo like it
@Nooble Then it's not a problem because statics are supposed to live during entire program.
@milleniumbug Right. The question is why returning an object from a function whose return type is object& works.
Xeo
Xeo
@Columbo lolz, as dupe of my question
@Nooble What's the problem?
should I pull in boost.asio just to add timers to my application? mannnn and to think i got away boost-free
19:00
@Nooble Why shouldn't it?
Can the "optimization opportunities for compiler writers" for noexcept really lead to measurable performance increase? (Not considering the library stuff for std::move.)
int i = 5; int& a = i; works
I didn't know that I could return an object as an object reference.
@Xeo move should be "as_rvalue", and forward should be "as_what_it_was_one_scope_ago" or something
Xeo
Xeo
@gnzlbg yes on std::move, not really on std::forward
19:01
@Xeo "what_it_used_to_be_before_you_could_name_it"?
Xeo
Xeo
std::forward "forwards" the value category
so it's not too bad a name
one thing, when writing std::forward... how does it preserve C-Arrays?
Xeo
Xeo
?
lol c arrays
like you cannot return a reference to a c array
Xeo
Xeo
19:02
It doesn't decay it or anything
but you can forward a c array
Xeo
Xeo
@gnzlbg you... can
i don't think so
personally I would rather that it would static_assert on them.
@milleniumbug If I have a function whose return type is object&, don't I have to return an object&? Because I didn't know it was legal to just return an object itself.
19:02
@Xeo mm you can??
Xeo
Xeo
Sure?
T (&)[N] would be the type
then it was a C array itself, what you couldnt return
Xeo
Xeo
yes
can't return C-style arrays "by value"
unless wrapped in a struct
vOv
so... as_lvalue.. can't take rvalue C-Arrays
Xeo
Xeo
it can?
19:04
but i guess those don't exist.. hoepfully
but then it can't return them as values
Xeo
Xeo
@gnzlbg Alias<T[]>{ inits... }
@Nooble You mean int& f(); int g() { return f(); }? Then yes, you take the thing f() refers to, make a copy, and then return the copy.
@Xeo that looks like unique_ptrs to arrays
Xeo
Xeo
template<class T>
using Alias = T;
with ^
Only syntax prevents you from saying int[]{ ... }
template<class T>
T& as_lvalue(T&& v){ return v; }
ah lol
Xeo
Xeo
19:06
^ can handle all the things
if I didn't forget something
template <class T> T& as_lvalue(T& t) { return t; }
template <class T> T const& as_lvalue(T const& t) { return t; }
template <class T> T as_lvalue(T&& t) { return t; }
this is what i had
Xeo
Xeo
@gnzlbg Err, the last is wrong
as l_value converts rvalue references to values
Xeo
Xeo
it's a) a universal reference, and b) returns a prvalue
*copies them
Xeo
Xeo
19:06
@gnzlbg ew
no
no
T will be an rvalue in the calling scope
i cannot do it with a cast
Xeo
Xeo
Why would as_lvalue(some_rvalue()) return a prvalue?
That's just broken
aaaaah, chat, stop limiting meeeeeee
Serious question: What is the difference between a programmer and a software engineer?
i need to write my own kind_of_forward_as_tuple function
Xeo
Xeo
eh
19:08
that detects rvalues, and in the tuple type, changes their types to lvalues
Xeo
Xeo
You sound like you have some serious X/Y issues
i want a make_tuple_fun(std::forward<Ts>(ts)...), that:
- forwards &, &const, as references into the tuple<T1&, T2const&>
- stores && as values in the tuple<T>
i thought a cast to not rvalue would do the trick, but that can't work,
anyhow the discussion helped, I'll write my own :)
@milleniumbug No, I mean't this (I asked it on SO). I think I get it now.
Xeo
Xeo
@gnzlbg Don't name it as_lvalue though
0
Q: Which to use: Classes or Structs in Classes?

user3072517So, I have a bit of a philosophical question in the realm of C++11 coding best practices. When creating an application which essentially transforms data from one system to another. Should you define everything in classes, or use structs within a class? Here is a more concrete example of what ...

^seems like fodder for programmers?
19:12
@Xeo i'll name it, forward_as_safe_tuple
Xeo
Xeo
@gnzlbg You still need that helper function though
That's what I meant
can't i just compute the correct tuple type, and then construct it with tuple_type{std::forward<Ts>(ts)...} ?
@Mgetz i feel like it would have taken less effort to search for "difference between class and struct in c++" than type out that q
Xeo
Xeo
@gnzlbg sure, also possible
if the types for the rvalues in the tuple, are just by value, it would trigger move construction automatically, while the & and const& would work as expected
19:14
@sehe I am writing a class template with an inner class that depends on the template arguments, so my types will be in the header anyway. The problem I have comes from the inner class dependance to these template arguments. But I think that an anonymous namespace is the way to go.
Xeo
Xeo
template<class... Ts>
std::tuple<std::remove_rvalue_reference_t<Ts>...> make_safe_tuple(Ts&&... vs)
{
    return { std::forward<Ts>(vs)... };
}
I guess
aaaaand... there is no remove_rvalue_reference_t
haha
Xeo
Xeo
hahaha
that is what i just wrote
template <class... Ts> auto forward_as_safe_tuple(Ts&&... ts) {
using tuple_type = std::tuple<std::remove_rvalue_reference_t<Ts>...>;
return tuple_type{std::forward<Ts>(ts)...};
}
@BartekBanachewicz Today, I raped my Java students with 20 minutes of Haskell.
10
19:16
anyhow gotta write my own too
@Pris it's a dupe of this anyway
Unfortunately, ghc wouldn't let me declare multiple local variables with let...in. I still don't know what happened. Oh well, let...in let...in fixed the problem.
@FredOverflow That sounds more like: "I helped heal my Java rape victims with 20 minutes of Haskell's loving, reassuring embrace."
i wonder what the standard comittee was thinking when they added the add_pointer_t and remove_pointer_t, but for the reference variants, only the add_lvalue/rvalue_reference_t but not the remove ones. Feels like they were just trolling
Xeo
Xeo
@FredOverflow wrong indentation?
@gnzlbg oversight vOv
19:19
@Xeo they are one line on top of the other in the transformation traits, for each add, there should be one remove, its like, basic sanity check
@Xeo I can't think of a better explanation. Maybe Sublime Text mixed tabs and spaces.
@gnzlbg There is remove reference something...
@FredOverflow Topic?
Functional Quicksort
@wilx which removes all of them, not just one particular kind
19:19
Evening, gentlemen.
@Mysticial Page not found.
@gnzlbg Why would you want to remove only l or r ref?
template <class T> struct remove_rvalue_reference { using type = T; };
template <class T> struct remove_rvalue_reference<T&> { using type = T&; };
template <class T> struct remove_rvalue_reference<T const&> {
using type = T const&;
};
template <class T> struct remove_rvalue_reference<T&&> { using type = T&&; };
Xeo
Xeo
@wilx <10k noob
19:20
@gnzlbg usually, this approach makes the most sense (it's function composition) and quite often you find that the "foo" you need (the unrvalue there) is actually an existing thing
@Xeo ...
template <class... Ts> auto forward_as_safe_tuple(Ts&&... ts) {
using tuple_type = std::tuple<remove_rvalue_reference_t<Ts>...>;
return tuple_type{std::forward<Ts>(ts)...};
}
@Mysticial good question actually. And quite nuanced :)
Xeo
Xeo
> Why are so many of you snobs?
Was the title, that's why the snobby response :P
@Jefffrey The end result was this:
quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort [x] = [x]
quicksort (pivot:rest) =
    let (smaller, notSmaller) = partition (< pivot) rest
    in  quicksort smaller ++ pivot : quicksort notSmaller
19:22
@Mysticial I'm almost tempted to post: "Why are so many newcomers to SO such whiny little bitches?" :-)
@Xeo lol
@JerryCoffin Do!
@wilx Somehow, I have to figure out a way to fit Puppy/Daisy into it though, to justify the "bitch" without its being denigrating or accusing.
but unrvalue cannot exist right?
I mean it can never make an rvalue into a value. Tops it will make it into an lvalue reference. Since when you call it .. unrvalue(a) it returns a value T, that in that scope is a temporary.
@FredOverflow again?
@ScarletAmaranth What do you mean, again? I don't think I've ever shown Haskell in a lecture.
19:25
Hang on, chrome crashed while I was trying to upload a screenie.
6
@FredOverflow I mean - why does everyone show quicksort with Haskell ^^
@ScarletAmaranth Well, the topic of todays lecture was "stacks, queues, and sorting", and there was a slide specifically dedicated to a functional variant of quicksort, in textform. So why not implement that in Haskell?
@FredOverflow I dunno, it was meant to be like: "oh noes, yet another Haskell quicksort"-kind of thing
Okay, okay. Next time, I'll do a live Monad tutorial ;)
@Mysticial wow, chrome sucks
occasionally it behaves weird on Mac as well
19:28
I just crashed twice more.
wtf
@FredOverflow just say it's a monoid from the category of endofucntors with unit as return and bind as join and everyone will understand right away - no need for tutorials
I thought they were burritos in space?
@FredOverflow: I would be interested how you did a queue in Haskell with reasonable semantics and speed.
I didn't. All I did was Quicksort. I had enough problems cramming that into 20 minutes.
user1804599
Nice.
19:32
But I think you can get an efficient immutable queue by using 2 stacks, with amortized O(1) enqueue and dequeue.
user1804599
I almost implemented generics.
@FredOverflow youre right; maybe you should demonstrate with an example afterall - filterM (const [True, False]) is the obvious candidate for a simple powerset implementation
user1804599
Only deduction now.
@рытфолд Deduction in a dynamically typed language?
user1804599
Yes.
19:33
@gnzlbg true. You can make it const, probably (making it un-move-from-able)
user1804599
f[A, B](x, y) compiles to f(new $lasagnascript$TypeList([A, B]), x, y) whereas f(x, y) compiles to f(x, y). I simply have to check whether the first argument is of type $lasagnascript$TypeList and unshift arguments and deduce appropriately.
this oreo drink is decent
for something that contains white stuff dissolved in water to obtain milk
if it weren't 22 I'd have also tried the coffee
I want to eat, but I also believe that I already ate plenty, what do I do
milk is just white stuff dissolved in water
Okay, I just rebooted the machine. As Chrome wasn't the only thing acting up.
19:37
@Columbo eat a little bit(e)
Lemme try again to post the screenshot.
@Puppy lol
Y U NO CLICK NUMBER THINGIES???
6
because he hopes for me to post another codegolf question
I wish I had some idea though
19:41
@TonyTheLion Because he's a bit crazy up there.
@TonyTheLion Because why would he
Can't see a reason
Because aaaarrghhhhh
(Apart from the comments)
unclicked number thingies
its like unread emails
user1804599
@FredOverflow Perl 6 and Julia also do it, though I think they don't support covariance.
19:42
@gnzlbg it's always simpler in the end (simple things should be simple): Live On Coliru
Feel free to post on SO ;)
@gnzlbg indeed (that's whole different matter though)
@рытфолд When you talk about Perl 6, it somehow feels like you're talking about an imaginary friend :)
user1804599
@FredOverflow The compiler input and corresponding output would look like something this: gist.github.com/rightfold/1267c845981bbc7d526e
@TonyTheLion He wants to see if it overflows after 64K.
@FredOverflow makes sense, he's properly dog-fooding Chrome-master-race-browser too
what's up with instruction manuals consisting only of pictures
words are less likely to be ambiguous
19:56
they thought of you when designing it
wtf does this up/down arrow mean near the button
press it once
hump it like crazy
@AlexM. depends on what is being documented
a thing that makes coffee
@AlexM. good
user1804599
I'm a genius.
19:57
I mean in the end I got it
but at each step I was afraid I was interpreting it wrong
the fear is the problem
@sehe I'm planning on buying Scott Meyer's Effective C++. However I wonder which edition I should pick. I saw there is a revised one for C++11 + C++14
(and my typing skills)
@AlexM. maybe save on translating for different markets?
@Rerito they're all still useful. I'd say, have SO, you don't need any of that. If you just wanna read it all to "assimilate" hopefully more parts, then, buy them all. I did
19:59
@sehe Having a paper copy is really useful to me because this way I can take advantage of my huge commuting time... So I guess I'm gonna do that :)
@Rerito get them both through less orthodox ways

« first day (1565 days earlier)      last day (3608 days later) »