« first day (2054 days earlier)      last day (2888 days later) » 

10:00 PM
@QPaysTaxes Not really
 
there's a few pieces you can do with lambdas that don't quite work with anonymous classes
like referencing local variables directly.
 
@QPaysTaxes Oracle added some new byte codes at the same time as they added lambdas. I'm not sure the two are actually linked, but there's still no compiler that accepts lambdas and produces Java 7-compatible byte codes.
 
well, suffice to say, it can be surprisingly complicated and they're pretty serious beasts.
maybe it will, maybe it won't
really it's too late for Java, and you know it is when even the C++ guys beat you to a core feature like lambdas.
 
@QPaysTaxes Only one?
@QPaysTaxes That's probably for the better.
 
10:10 PM
?
 
fuck default construction in every way
initialize it with a meaningful useful value
because that makes absolutely no sense whatosever.
when you're in the template, don't randomly default-construct it?
 
you can't default construct arbitrary types anyway
for a very good reason really
IMO less types should be default constructible
 
you certainly can do
default-construction is just a fucking plague
 
you can't default construct types that are not default constructible
 
well, sure.
but it's simple enough to make a default-constructible constraint
what exactly is the code that is an error or not?
illegal by Standard, undetectable at compile-time by Standard
 
10:17 PM
@QPaysTaxes fail.
I mean the code is a fail.
 
thank C for conversion from 0 to pointer
 
it's officially undefined behaviour.
 
@QPaysTaxes Avoid using = 0; and instead use something like T foo = T();
 
@JerryCoffin Don't help him write crap ;p
 
10:19 PM
@QPaysTaxes Where did you see any hint of putting a 0 inside the parens?
@QPaysTaxes One of the places that "universal" initialization may be acceptable.
 
@QPaysTaxes In case you already don't know: initialization in C++ is fucked up
and the code?
 
@QPaysTaxes Start from (close to) the end: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = ctn_struct; _Dp = std::default_delete<ctn_struct>]
@QPaysTaxes Correct (a unique_ptr can be moved but not copied).
 
If you use std::initializer_list (i.e. std::map<?, ?> m = { stuff }), then don't - it's a broken feature
 
user1804599
YouTube is fun
 
same thing in this case
some time I'll write a list of what's wrong with std::initializer_list, but for now, food for thought: you can't move stuff from it
manually
 
10:32 PM
@QPaysTaxes Probably start with an empty map, then use emplace to put the data into it.
 
IKR
10 mins ago, by milleniumbug
@QPaysTaxes In case you already don't know: initialization in C++ is fucked up
 
@Mysticial Bwahaha, while this is hilarious, I'm disconcerted to see an official school document stating "a Matlab code", code is like sand, you dont have a sand or many sand you have sand.
 
alternatively you could use an iterator pair constructor of std::map
and pass iterators made with make_move_iterator to some existing container
 
@Borgleader Agreed. "a Matlab code" doesn't make sense. Maybe "a matlap code" does.
 
@Borgleader "A Matlab code" makes perfect sense. Somebody's try to pirate Matlab, and they want one (and only one) installation code so they can install their stolen download.
 
10:39 PM
@rightfold I'm worried for your health. How's your job? Still enough of a challenge?
Our job position got filled :|
 
@QPaysTaxes this, but there's are so many things going on in this code I'm almost reluctant to post it
 
So as a general question, depending on the outcome of the upcoming US presidential election, what are my chances of being able to claim refugee status and move elsewhere? :-)
 
which outcome leads to not wanting to claim refugee status?
 
@JerryCoffin If Trump wins, you can always move to Mexico - you'll have a wall protecting you from him :P
 
if he manages to get anybody to pay for it
 
10:43 PM
@Puppy Bernie somehow manages to win, even though it doesn't currently look like he'll even be on the ticket?
@QPaysTaxes A std::array is (very carefully) specified as being an aggregate, so what looks like an initializer_list is really C-style aggregate initialization.
 
@QPaysTaxes It's not initializer list because it's used for initialization of std::array which has no constructors, as opposed to std::vector and std::map which have std::initializer_list
22 mins ago, by milleniumbug
@QPaysTaxes In case you already don't know: initialization in C++ is fucked up
@QPaysTaxes yes
 
std::array<int, 0>{{}} - the r******** *****a operator
@QPaysTaxes Because the committee was too afraid of making tuples a language feature.
 
@QPaysTaxes To allow things like std::vector<int> x{1,2,3,4};
 
nooope :D
 
@QPaysTaxes To make initialization ~~easier~~, but they completely missed the point by failing to take into account real use cases
 
10:47 PM
@QPaysTaxes Sorry, wrong phrase - because the committee was too afraid of making tuples a core language feature.
That's a language feature that's usually night unusable.
 
@JerryCoffin I love when we have to explain the unexplainable
 
The best part is that std::initializer_list breaks some not directly related features
 
(Unless you're doing some weird generic code and are too damn tired of reimplementing it and just decide to use it.)
 
like perfect forwarding and uniform initialization syntax
 
@Griwes I only use it for generic code, and with tie
 
10:49 PM
@sehe I mostly only use it in really weird pieces of code.
 
That's a kind of self fulfilling prophecy
 
like here
 
@QPaysTaxes there was a great effort to make it possible to declare a function that when called with f(whatever) calls another function as if it was g(whatever)
 
or here
In both cases I really wish I had a better tool than std::tuple.
 
@QPaysTaxes but initializer_list... breaks this because now f({ ... }) isn't equivalent to g({ ... }) (the first is an error)
 
10:51 PM
Funnily enough I want two distinct tools for those use cases.
 
b b b b b booost::tuple (jk)
 
@sehe lol good one
 
ikr
 
@QPaysTaxes By being preferred over essentially any other form of initialization if at all possible, and other forms are only considered when/if it's completely impossible to interpret the code as using an initializer_list.
 
@QPaysTaxes You can't call template<typename T> void foo(T && t); as foo({1, 2, 3}).
Which is a gigantic fail really. ;p
(that's clearly a tuple right)
 
10:53 PM
i know, right
 
Also there was a bug in the standard where auto i{ 1 }; would make i an std::initializer_list<int>.
Though I think Ville fixed that (lol Ville did a good thing for once).
@QPaysTaxes But then it's not perfectly forwarding anymore!
 
4 mins ago, by milleniumbug
@QPaysTaxes there was a great effort to make it possible to declare a function that when called with f(whatever) calls another function as if it was g(whatever)
this ^
 
@QPaysTaxes forwarding without flaws
 
Also I'm pretty sure template<typename T> void(std::vector<T> ts); isn't callable as foo({1, 2, 3}); either.
 
@QPaysTaxes YES!
 
10:55 PM
@QPaysTaxes That's exactly what it is, hence the name.
 
And it was not technically possible before, and became even more contorted with move semantics
But now, we can achieve it!
And most importantly, you don't know the value category
 
And most importantly, std::initializer_list doesn't allow you to move from its insides ;_;
Goddammit that should've been the first fix that got into C++14.
 
That's not most importantly. It just adds a modicum of insult
 
@QPaysTaxes Just in case it wasn't clear here: the emphasis is on "the same". Not a copy of the arguments, nor a reference to a temporary created from the arguments, but exactly the arguments themselves.
 
;D
@sehe It'd be far more usable if the constness misfeature was removed.
inb4 I get quoted on that out of context
 
10:58 PM
@QPaysTaxes That usually takes a while to understand.
 
A while is the ISO unit of 21 years
 
:D
 
@QPaysTaxes How many weeks ago you started learning C++? 5? Then don't be discouraged. I'm in this chatroom since 2013, and some of the things still confuse me.
point made
 
@sehe I'll take your word for that. I'm pretty sure I read the first Usenet post to mention the concept at all, but I'm still not entirely certain I fully understand it--I usually think I do, but then every once in a while something trips me up.
 
@QPaysTaxes If you have E = (A + B) * C then you have some expressions which are temporary, and some of them which aren't
If you can distinguish between temporary and non-temporary expressions, then, if the values manage some expensive to create resource (imagine a large 10000x10000 matrix), you don't need to create it every time, you can move it from one to another
because you can't access the temporaries
with value categories, you can distinguish which expressions are temporary, and which aren't
 
11:10 PM
@JerryCoffin Likewise here
 
The calls to rand() create temporaries
 
@QPaysTaxes Because the compiler breathes life into all values. This is how it knows the intimate details of it. It's basically Psalm 139 but for programming language design
 
11:47 PM
@QPaysTaxes The compiler works more or less the reverse of that: it can eliminate the common sub-expression if and only if it can prove that doing so produces the same result as not doing so. Its default is to treat the two calls as being complete separate, so it can't collapse them. In this case, it could very likely generate that code inline (using link-time code generation), in which case it'll have a direct view of the fact that they can't be collapsed into a single call.
 

« first day (2054 days earlier)      last day (2888 days later) »