« first day (1043 days earlier)      last day (3914 days later) » 

7:10 PM
@Borgleader nope, March 2014
 
Oh I see.
 
@Borgleader Of course you do. You couldn't really write C++ programs without a C++ compiler either, could you?
 
@FredOverflow Haha, what I actually meant by that was I thought I had it installed already
 
Oh. Well, of course. Why would anyone have a Java SDK installed already? :)
 
xDDD
So the homework, you just submit it. It gives you a score and you can re-sumbit as many times as you want?
 
7:13 PM
@Borgleader Sounds like my university's system. We have a cap of like 3 per 12 hours, though.
 
If in doubt, static_cast
 
@FredOverflow you could write them ;)
 
Is there a class
 
@DeadMG Reddit uses ~~x~~, not ---x--- ;)
 
7:18 PM
that executes a given random functor in its destructor
 
@KonradRudolph Fuck, I even used the formatting help thing to check what the syntax was on Reddit, I obviously opened it, looked at the contents, but didn't read them.
 
... Probably not.
Better go write it..
 
@ThePhD There is, and it sucks so horrifically, if you ever find yourself using it, you should delete all your code.
 
Oh I'm mistaken. It's on /r/programming
Wow a C++ post on proggit without bashing.
 
@DeadMG I need it for some code that uses a given allocator or std::allocator-alike.
 
7:20 PM
no, you don't.
 
It should be trivial enough to write it. I'll get on it...
 
@ThePhD wot
 
it's kinda like, "I need a Singleton".
nobody ever actually needs a Singleton for basically anything.
 
@DeadMG And I agree that expected has richer semantics than optional but the latter can be used (and is used) in the same context – i.e. not having a value doesn’t necessarily mean we move on, it means an operation has failed. Case in point: reading a value. For instance, I have a function optional<T> read_value(istream&) that is part of my core tool box
 
@KonradRudolph Then in that case, I would argue that your function is bad and wrong.
I would say
it's kinda like using T* to own objects. You can do it and it is used for that, but it's not something you should ever do.
 
7:21 PM
@DeadMG Argue all you want. By contrast, I argue that it’s good and vastly superior to anything C++ has to offer out of the box, in particular to the cin >> x formatted input
 
[–]dukey -5 points 1 hour ago (1|6)
I can't recall ever using static_cast or other such abominations in c++
 
@KonradRudolph Well I'm definitely going to agree that it's way better than cin >> x.
and the iostreams error handling in general is incredibly bad.
@ThePhD Also, it's called ScopeGuard.
 
void class_name::exception_throwing_function () {
     auto onexit = make_exitor( [] () { myallocator.deallocate( mydata, mysize ); } );
     // Blah blah blah
     throw out_of_memory();
     //
}
 
@ThePhD It would be trivial to write, here is some untested code:
class Class
{
    std::function<void()> f;
public:
    Class(const std::function<void()>& f) : f(f) {}

    ~Class()
    {
        f();
    }
};
 
@ThePhD Make it into a proper dedicated RAII object- a deallocator.
 
7:23 PM
make_exitor? lol
 
Better than make_destructor
 
Both are bad
 
It describes what it does.
So it works for me.
 
@KonradRudolph Frankly, it's closer to right than iostreams is by a good chunk, but right would still almost certainly not entail that.
 
Anybody know how hashcode functions work?
 
7:26 PM
@ThePhD I guess that it would be too much for mydata to be, I dunno, a unique_ptr or something?
 
@Pawnguy7 by returning a number
@Pawnguy7 Or do you mean good hashcode functions?
 
@DeadMG Then I need to write allocator_deleter
 
@DeadMG I feel that the next better step would be a full-blown, composable monad, but C++ lacks the syntax to make this possible concisely so I don’t think it would offer a tangible advantage
 
And that's a pain.
 
Well, I was trying to learn how hashtables work... figured I should start with how hashes are made.
 
7:27 PM
@ThePhD Yes, you do. As in, that's the only safe, sane way to do it.
 
the best we can do is rename optional to something like expected to make the intentions clearer.
 
@ThePhD You have no choice, essentially.
@Pawnguy7 You don't really want to do that. Hash functions are fiddly little bitches that you want to stay away from.
 
Evening guys
 
@DeadMG Orrrr....
template <typename TFx>
struct exitor {
	TFx fx;

	template <typename TFunc>
	exitor( TFunc && func ) : fx( std::forward<T>( func ) ) {

	}

	~exitor( ) {
		fx( );
	}
};


template <typename TFx>
exitor<TFx> make_exitor( TFx&& tfx ) {
	return exitor<TFx>( tfx );
}
 
@ThePhD No.
not only did you break your references
 
user1804599
7:30 PM
> ( foo )
 
user1804599
My eyes.
 
@Pawnguy7 at a very very high level, a hash function simply assigns a number to whatever data is stored in the hashtable.
 
but all you've done is duplicate the Deallocator function a billion times.
if you use the exitor for the same job more than once, you're breaking DRY.
and if you only need it once, then just use try/catch, frankly.
 
@Pawnguy7 If you are storing numeric data, then there is nothing to it. In fact, I think that's probably the best way to learn about hashtables: just store ints in the table.
 
not to mention that you are manually tracking whether or not your resources need destruction or not.
which is just as hideously bad as owning raw pointers.
which you will get very wrong.
 
7:31 PM
@MonadNewb Integer keys?
 
user1804599
I have never seen any of you.
 
This looks plenty fine to me.
 
user1804599
RUN! RUN FOR YOUR EYES!
 
@Pawnguy7 yes, just treat the int as both the key and the data.
 
@KonradRudolph Why not? But more importantly, I feel that there's a real issue with the assumption accessors (*opt and opt->) that optional offers, so that it's not really any better than cin >> x really.
 
7:34 PM
or ignore the data completely since a hashtable only cares about the key.
 
user1804599
@MonadNewb Ain't that a set?
 
Sounds like an array :D
 
user1804599
No need to store the data twice.
 
user1804599
It's a waste of memory of which you have plenty anyway.
 
maps are just sets that store pairs and are associated by the first value.
 
7:35 PM
@DeadMG Could you expand on both points? First of all, what do you mean by “why not”? No tangible advantages? If so, the answer is that proper monads in C++ would probably have overly cumbersome syntax that would destroy their advantages.
 
user1804599
I Can't Wait is a nice song.
 
@not-rightfold sure you can implement a set ADT with a hashtable datastructure. Java has one implementation that does that exactly.
 
@KonradRudolph Ok. The second point first, since that is simpler.
 
go ahead
 
namely, what is the difference between std::cin >> x; std::cout << x; // UB if x not read and optional<int> x = read_value<int>(std::cout); std::cout << *x; // UB if not read
 
7:36 PM
@not-rightfold Yah, I didn't mean that you need to store the int twice. It's just one way to think about the key and data for a hashtable when you first learn about implementing one.
 
in both cases, it is trivial for me to assume that the value is valid and have UB if it isn't.
I admit that it's syntactically simpler, composable and stuff like that, but I'm not sure how it's better from an error handling perspective.
 
user1804599
Throw an exception.
 
@not-rightfold Not for operator* and operator->.
 
user1804599
Always throw exceptions. No UB.
 
and if you do throw an exception, why bother with the optional at all, just throw when the value failed to be read.
as for the first point
I don't really see why an optional<T> monad-style thing in C++ would have unacceptable syntax, beyond the fact that lambda functions are somewhat uglier than they could be.
 
user1804599
7:39 PM
std::optional<T> should have throwing * and UB-ing .unsafe_dereference().
 
Does a hashtable have an array internally?
 
@not-rightfold Pretty sure that it has UB-ing operator*.
 
user1804599
@Pawnguy7 Array of buckets.
 
user1804599
@DeadMG It's badly designed.
 
@Pawnguy7 It must have an array.
 
7:40 PM
> The behavior is undefined if *this is in disengaged state.
 
@not-rightfold Depends on the use case.
UB-if-failure is a useful tool, not commonly, but occasionally. The real issue is making it too accessible.
 
user1804599
Unsafe operations must be marked as unsafe in their names.
 
@not-rightfold Optional has value_or.
So you can do x.value_or(10); I guess
x.value() would throw
So.. there are options... in optional.
 
@Rapptz Most people are going to use the pointer accessors, almost regardless of their semantics.
 
user1804599
@Pawnguy7 A hash table is an array of buckets and each bucket is a linked list, array, BST or whatever of keys or (key, value) pairs (depending on whether it's a dictionary or a set). The bucket a key corresponds to is calculated using hash(key) % num_buckets.
 
7:43 PM
@DeadMG Doesn't really change the fact that it's there. People can make poor decisions if they want to.
 
@DeadMG You’re getting to the heart of the issue, correctly. In this regard, the only advantage that optional offers is that it makes accessing the value explicit. We’re essentially telling the compiler that we’re confident that the value is there
 
@Rapptz True, but there is certainly something to be said for pushing people into the pit of success.
 
In my optional I made operator* throwing
 
But of course * can be argued to be too innocuous, and that we should choose a more verbose, explicit syntax analogous to the choice for *_cast<T> rather than C-style (T) casting.
 
@KonradRudolph * and -> are not very explicit compared to the cin version.
 
user1804599
7:45 PM
@Rapptz hug
 
Well cin has no such barrier at all, so it’s a bit better
 
very true.
 
What determines how many buckets it has?
 
but what I'm saying is that the T read(istream&) version that throws is a lot better.
 
Should allocator_deleter also call destroy on all objects it deallocates?
 
7:46 PM
@DeadMG Precisely: we would have to use quite a lot of lambdas, and at the moment I find them simply unacceptable syntax overhead, until they get rid of the need for braces and return.
 
@KonradRudolph I don't really have a problem with them.
 
user1804599
@Pawnguy7 Varies. It can be constant or it can grow if the number of elements grows. The latter case has a drawback that the existing elements must be repositioned.
 
@not-rightfold s/hash table/slow hash table
 
@DeadMG It's better as a default, but should also have another version with reports failure by returning bool and taking a T& to read into.
 
user1804599
@NikiC why
 
7:47 PM
I’d argue that the advantage of explicitness and safety that we would get from using proper monads would be overshadowed by the lambdas making the code more complex and harder to (visually) parse
 
@ThePhD Nope, that's bad.
 
@not-rightfold Fast HTs typically use some open-addressing mode, not chaining
 
user1804599
What do you mean by chaining?
 
@ThePhD Your container is responsible for destroying them when it is destroyed, so yes.
 
@not-rightfold where each buckets stores the elements that collide in it (in a linked list)
 
7:48 PM
Agh
 
user1804599
What do you mean by open-addressing mode?
 
allocator_deleter doesn't offer the flexibility I need
 
user1804599
Also it doesn't have to be a linked list (as I mentioned).
 
@not-rightfold It means that collisions are resolved using probing
 
@KonradRudolph Well, I kinda disagree. I think that if you are calling many functions and propagating the errors, then you are really just emulating exceptions, and I have little sympathy for how the syntax sucks when the language has dedicated syntax for that functionality.
 
7:49 PM
@not-rightfold Chaining is what most std:: implementations of unordered_map do: they provide an array inside each bucket (or a list) that stacks collided elements within another data structure inside that bucket.
 
user1804599
What do you mean by probing?
 
user1804599
Google returns this result:
 
user1804599
Ah, I see.
 
user1804599
But I included that in my definition!
 
user1804599
> or whatever
 
7:51 PM
@not-rightfold Open-Address is where an array is laid out with the data. Collision resolution is determined by probing other cells in the hash table using some secondary or special collision-avoider function. Objects which collide get stuffed into other "open" spots of the array.
 
Too much one-boxing.
 
@DeadMG But if you expect errors (such as when reading input), exceptions are arguably not the right way at all. Compare Eric Lippert’s rant on exceptions
 
user1804599
Exceptions are nice.
 
@KonradRudolph I think he's wrong.
 
lol "only throw exceptions in exceptional cases!!@!#!"
 
user1804599
7:52 PM
Throw exceptions and never catch them.
 
I'mma grant you that exceptions are not the ideal tool in some situations, and that sometimes I wish for a different tool.
I encountered such a condition myself just yesterday.
however.
a tool that permits UB by referring to unread data is not better.
 
Do you expect operator*'s semantics to default to a specialised value_or?
 
ultimately, I think half the problem is people trying to parse input using these shitty "ParseXDataType" functions.
instead of using a real parser.
 
user1804599
@Rapptz eww.
 
that can actually parse shit
 
7:54 PM
Open-addressing's problem is that its fixed-size and can't expand as easily as a chaining hashtable can. It's benefit is cache locality.

Chaining's problem is its memory requirements for deferred-allocation of memory spots (e.g. the problems of a std::list versus a std::vector). It also has the issue that if you have enough collisions, you invoke the horrible condition that all the elements are stored in one bucket (std::list searching for 200 elements in a bucket: DDoS the lookup server, anyone?) But, it's benefit is that it can grow to arbitrary sizes and also keep buckets of the same ha
 
user1804599
@ThePhD Yes, I have been told three times already.
 
Oh. Sorry. :c
 
@DeadMG He is – to some extent. I think he’s right for things like IO. In particular, where monads are properly supported, typesafe exceptionless IO requires much less code than exception-driven IO
 
user1804599
Use longjmp.
 
I don't really like exceptions.
 
user1804599
7:56 PM
Pass a jump buffer to the object that is responsible for doing I/O.
 
@not-rightfold Wha?
 
@KonradRudolph Well, the first thing that I'm going to say is that even if monad I/O > exception I/O, exception I/O is still > error code I/O (which your optional<T> read basically is), and therefore if you can't do monad I/O, you should still look to exceptional I/O.
 
I'm conditioned to feel guilty when using exceptions
 
user1804599
@ThePhD Because they can't all be caught using void*, right?
 
@ThePhD The O(n) worst case condition is there for all HTs, regardless of what collision resolution you use
 
7:56 PM
@not-rightfold catch ( ... ) :P
 
@DeadMG No way is optional like exception code. Exception code IO abuses the return value and as a consequence requires passing the value through as a return argument. That is a huge difference
 
@NikiC You can more easily trigger it by finding a flaw in the Hash that uses Chaining.
 
@KonradRudolph It's just a bit of syntactic sugar.
 
for instance, it makes it impossible to initialise values with an input value in their declaration (and as a consequence cannot make them const etc)
 
@ThePhD Why? In both cases you just want to collide all keys to one hash, which is equally hard (or rather, equally trivial) for both cases.
 
7:57 PM
@DeadMG No, it’s way more, see previous message
 
the simple reality is that it is trivial for anyone to assume that the optional has a value in it, and invoke UB if it is not there.
that's the real problem.
the const thing is nice but essentially irrelevant.
 
How should I make a hash function? ("The C++ Standard doesn't provide a hash for this type. ").
 
@Pawnguy7 Delegate to std::hash.
 
@DeadMG Ideally a proper wrapper (well, not std::optional) wouldn’t yield UB but an exception
 
@Pawnguy7 namespace std { template<> struct hash<my_type> { }; } etc
 
7:59 PM
@KonradRudolph Then skip the optional and just throw in read.
 
@DeadMG I beg to differ, I find it very relevant.
@DeadMG But that’s different, because it throws at a different place (the wrong place) and thus requires exception handling in my client code which I can forego with correct usage of std::optional
 
ok, so how are you going to initialize a const value from an optional without assuming it is there or introducing a nested scope?
 
@NikiC All you need to do is find one hash value that'll repeatedly hammer the same bucket: that bucket's performance (with a linear search or something) will degrade far faster. E.g., compare a 16-bucket Chaining HT with one bucket filled with 200 elements because of collisions, versus a 200 * 16 slot array with 200 elements being kicked off to surrounding elements using something like Hopscotch Hashing (but not Cuckoo Hashing, because it's performance degrades rapidly. :P)
 
user1804599
@Pawnguy7 If you want to consider multiple values in your hash, hash a tuple.
 
@DeadMG auto const x = read<int>();
and then if (x) … else …
 
8:00 PM
er, OK, but that's not a const T.
 
@KonradRudolph Erm, a failure monad does that as well.
 
user1804599
Doesn't std::optional have begin and end members?
 
of course I’d love to remove the if in favour of a type-safe dispatcher (a la static_visitor) – but expected<T> doesn’t actually offer that either
 
I could do const std::optional<T> x = cin >> var ? var : none;.
 
user1804599
Then you could use it with range-based for. :P
 
8:01 PM
@DeadMG Indirectly, sure, because const is viral. You cannot modify the T value either
 
user1804599
Copy it.
 
@not-rightfold No but you can add the idiom (as non-members, of course) – and I don’t consider that a half bad idea
 
@KonradRudolph static_visitor? is that what boost::variant has?
 
probably introduce helper function for this purpose instead of needing a new var every time.
 
@Borgleader Yes. The code here would be slightly different but the idea is essentially the same: having type-safe dispatching. However, the syntax for this would simply be atrocious, which is what I’m saying all along
 
8:03 PM
Monads~
 
@ThePhD Sorry, I still don't see the difference. In both cases you'll end up with O(n^2) perf for inserting n elements. Ofc the open addressing HT will be faster, but only because it's faster in general ^^
 
brb, cooking a steak
 
user1804599
@NikiC I tried yield today in PHP and it was quite nice.
 
@KonradRudolph OK, so you want an exception-throwing accessor, but you don't want to throw an exception..?
seems to me like a CPS-style read<int>(istream, [](int x) { ... }) function would be a better choice here.
 
user1804599
Btw, is it really impossible to get typed results from PostgreSQL? The pg_fetch_* set of functions always return fields as strings. (I tried to wrap PostgreSQL API with generators. :))
 
8:05 PM
that's somewhat dodging the problem rather than fixing it, of course.
 
@not-rightfold Yes, yes it is :)
 
@DeadMG No, my statement doesn’t have that contradiction. What I want is to use exceptions as a fallback if the user failed to check for value existence
 
@KonradRudolph ... or just don't offer a T& accessor.
 
@DeadMG Well yeah, theoretically. But CPS + C++ is simply unpractical and will never be idiomatic
 
@NikiC Not quite: the open-addressing scheme means that when you try to find the bucket you are looking for, you do:
unsigned hash = compute_hash( key );
unsigned bucket = hash / bucket_capacity;
// capacity 16 for the closed-addressing. You're only using the lower 4 bits of your hash value -- much worse collision performance
// bucket_capacity >>> 16 for open-addressing. You're using a lot more than 4 bits, and thus your hash has more spread over the "bucket list"
 
8:07 PM
@DeadMG … coupled with a safe accessor idiom such as range-based for, sure, sign me up. In fact, I’m motivated to program that right now. The problem with this is that it doesn’t compose, and thus requires deep nesting when multiple values need to be read
okay, afk
 
@KonradRudolph your steak is going to burn
 
@not-rightfold I don't think so, but I'm not sure because I never worked with pg. String results from DB are typical in PHP
 
user1804599
@NikiC Hmm. How trivial is it to write a PHP extension? This stringly-typed crap makes me go crazy.
 
@ThePhD I assumed we were talking about a proper hash collision, not just an index collision :)
 
@KonradRudolph Just like a monad.
 
8:10 PM
@not-rightfold Uh, no, don't go down that line. Writing a PHP ext is not simple
 
@NikiC Shrugs. Well, I dunno then. Maybe they'd be equal. :D
 
@not-rightfold You can get the field types using php.net/pg_field_type though ;)
 
user1804599
@NikiC That's getting fun with user-defined types. :P
 
user1804599
It will probably return the name of the UDT. I'll figure something out.
 
@not-rightfold That's why I'd just leave it at string ;) In PHP strings can act as integers/floats anyways
 
user1804599
8:14 PM
@NikiC but not as datetimes, polygons and arrays.
 
11
A: How do you input commandline argument in IntelliJ IDEA?

Damian NowakALT+SHIFT+F10, RIGHT, E, Enter, Tab, enter your command line parameters, Enter. ;-)

shortcuts :3
 
@not-rightfold ah yeah, might make sense to put that into some proper format
 
user1804599
I have array_to_json(array_agg(gp.group_id)) in my code base because otherwise it's a hell to parse the output. XD
 
though it is beyond me what an array is doing in a relational database ;)
 
user1804599
@NikiC Very useful when selecting multidimensional data.
 
user1804599
8:15 PM
I don't use them as types for columns, though.
 
@LucDanton Monads compose by definition
 
@not-rightfold good ^^
 
... no they do not :v
 
@LucDanton … I’m talking about bind
 
user1804599
@NikiC (Here is the query in question: gist.github.com/rightfold/e37f5bf7e38cad4e996d. The goal is showing a table with permissions and groups with checkboxes to enable/disable the permissions per group.)
 
8:19 PM
@KonradRudolph Right. I knew this wasn't about commutative monads, forgive the quip.
Still though, it's do notation that avoids the silly nesting to the right. Not monads.
 
@LucDanton Yes, of course, I am aware that you can implement monads in C++ – but like I said they’d be verbose because C++ has no syntactic sugar for them
I’ve been trying to bend my “named operator” idiom to implement something akin to do notation
 
Then talk about do-notation. Not monads.
 
user1804599
The only two other options I see are doing a select query for each permission, or fetching all permissions, groups and group permissions and then doing complicated operations on the returned data sets.
 
user1804599
Fetching (permission, array of group permissions) pairs is much easier.
 
@LucDanton I originally didn’t talk about monads at all. Somebody successfully confused me into mentioning them ;)
 
8:23 PM
@not-rightfold I'd probably just do the join and do the grouping in code
i.e. just iterate through it and put everything with the same id in one set ^^
 
@KonradRudolph Oh. That is a clusterfuck.
 
in mysql that is. in pgsql yours might be a better solution as it already has support for it
 
That proposal for resumable function involves syntax that is very similar to do-notation btw.
 
user1804599
MySQL is BadSQL.
 
Hrm. I am confused.
 
user1804599
8:27 PM
Me too. Why is there so much bad software?
 
@LucDanton What even would do-notation look like in C++?
 
@not-rightfold Because the majority of programmers suck(s?).
 
user1804599
@FredOverflow "sucks" if you apply Dutch rules. :P
 
user1804599
@DeadMG I'd say like in F#.
 
I have no idea what it looks like in F#.
 
user1804599
8:29 PM
optional_monad {
    auto! x = something();
    auto! y = something_else();
    return x + y;
}
 
was this the old C++ chat room ?
 
how is that substantially different to f() { auto x = something(); auto y = something_else(); return x; }.
 
@DeadMG Assuming it should be generic, the only generic mechanism in place are calls to function templates.
 
user1804599
@DeadMG if something() is none, the result is none. if something_else() is none, the result is none, else the result is *x + *y.
 
explicit specialization; 'std::hash<_Kty>' has already been instantiated
Says something about enums in the source, though I don't know how that is related.
 
8:31 PM
@LucDanton do you know what compilers support relaxed constexpr?
 
user1804599
Probably needs something better than return, like unit.
 
user1804599
The entire thing is an expression, not a statement.
 
@not-rightfold So really, it's more like, I dunno, a macro.
yessss, a motherfucking mac ro.
 
user1804599
Do notation is syntactic sugar for chains of monadic binds.
 
Which overload of std::vector's constructor is called if I initialize my std::vector<int> with {size} in my initializer list? size is 10 but the actual size is 1. If I replace {} with () the size is 10. What's going on?
 
8:32 PM
@Tuntuni List-initialization.
Versus direct.
 
so
 
@chris The std::initializer_list one?
 
@Tuntuni Yes.
 
Are you doing std::vector<int> v{size}?
 
@Tuntuni Welcome to "Uniform initialization sucks terribly".
 
8:33 PM
@Rapptz No. constrcutor() : id{size} {}.
@DeadMG :'(
 
user1804599
It would be the same as something() >>= [=] (auto x) { return something_else() >>= [=] (auto y) { return make_non_none_optional(x + y); } } (ignoring irrelevant stuff like [=] idgaf) assuming >>= is monadic bind.
 
@DeadMG initializer_list sucks terribly*
 
@chris So how would I make it call the overload with the size as argument?
 
@Tuntuni With parentheses.
 
use parentheses.
 
8:34 PM
No other way?
Wow.. lol.
 
Some guy posted a question: "I found some code on SO, and I don't understand it", I asked him to link to where he found it "Oh sorry it wasn't on SO." -.-;
 
@not-rightfold Why not something() >>= [=](auto x) { return make_tuple(something_else(), x); } >>= [=](auto x) { return std::get<0>(x) + std::get<1>(x); };?
 
@Rapptz No.
 
user1804599
@DeadMG Because tuples aren't monadic.
 
@DeadMG In the case of, say, optional, you can use a simple set of rewrite rules.
 
8:36 PM
16
Q: Preventing narrowing conversion when using std::initializer_list

Red XIII#include <iostream> struct X { X(std::initializer_list<int> list) { std::cout << "list" << std::endl; } X(float f) { std::cout << "float" << std::endl; } }; int main() { int x { 1.0f }; X a(1); // float (implicit conversion) X b{1}; // list X c(1.0f); // float ...

 
user1804599
(>>= is left-associative in Haskell.)
 
@LucDanton :( I'm tired of ? : and #define hacks.
 
@not-rightfold What difference would that make? There's no reason for the contents of the optional<T> to not be any T at all.
 
Someone answered a question of mine from over a year ago.
 
@not-rightfold It is in C++ too, I think.
no, wait, it isn't, ignore me.
 
user1804599
8:37 PM
@DeadMG No. x >>= y >>= z.
 
@Rapptz Would std::vector<int> {{1}}; do the same thing?
 
you could use >> for left-associative, I think. std::cin >> x >> y, no?
 
{{1}} would call the initializer_list
 
You answered this one, too, DeadMG.
 
@Rapptz Clang SVN does, I believe.
 
user1804599
8:38 PM
template<typename T, typename U> std::optional<U> operator>>=(std::optional<T> const& x, std::function<std::optional<U>(T const&)> const& f).
 
> 1. Instantiate an instance of a singleton template type.
 
user1804599
(again idgaf about std::function parameter)
 
I have a bad feeling about this answer.
 
@Rapptz So both {} and {{}} call the initializer_list?
 
@Tuntuni heh
 
8:39 PM
@Rapptz WHyyyyy :(
 
See, it's initializer_list that sucks.
 
Now I have to use () :(
Fuck you C++
This is my first time saying it in 5 years.
 
@not-rightfold You could just use a different operator like >>, which should be left-associative.
 
user1804599
Indeed.
 
{{}} is for other things too like with aggregates, e.g. std::array<int, 3>{{1,2,3}};
 
user1804599
8:42 PM
I'm going to work on a statically-typed dialect of Gear that supports asm.js.
 
@Rapptz Ahh. Before, aggregate-init was only possible with = {}?
 
user1804599
I have no idea how to implement type-inference.
 
@Tuntuni No no.
 
@Rapptz Oh? So Aggregate a = { ... }; wasn't the only way to init an aggregate before?
 
Not that I know of.
 
8:47 PM
So what are the other ways?
 
Wait, nvm, I'm thinking of the wrong thing.
 
Ah, ok.
@Rapptz So basically, it's impossible to init a class with uniform init using a constructor that accepts a type that's convertible to std::initializer_list?
 
a type isn't "convertible to std::initializer_list"
I gave you a link earlier.
 
@Rapptz Right. Then "can be used to initialize a std::initializer_list" is right?
 
With brace-init, the initializer_list constructor is preferred. That's all
 
8:53 PM
@Rapptz Ah okay. I'll check the links again. Thanks.
 
@Borgleader Forget it, I’m a steak pro. Juicy like a <dirty simile>.
 
@Borgleader I'm stuck at 87% :( stupid backwash
 
@FredOverflow I just started the implementation. Took me a while to read the instructions, install their damn libraries and add them to Intellij
 

« first day (1043 days earlier)      last day (3914 days later) »