« first day (424 days earlier)      last day (4521 days later) » 

10:01 PM
in c++11 those expressions are called "discarded value expressions" IIRC
so they can say "a discarded value expression e of class type cv X calls e.operator void, if X has a (possibly inherited) member of that name."
 
i feel like "discarded valu eexprssion" is the wrong thing tho. too lazy to lookup
@AlfPSteinbach ohh thanks
didn't know that group! i will join
 
So, basically, change void into a unit.
 
Something is technically wrong.

Thanks for noticing—we're going to fix it up and have things back to normal soon.
 
@AlfPSteinbach i pressed "ask to join group". who will answer it?
i have no clue how it works
@AlfPSteinbach i guess Andrew is the most prominent guy on that group
@AlfPSteinbach do you think that USA will try to get the drone back by force?
 
10:14 PM
I say nuke it.
There is a quick way of raising the worldwide average quality of life: nuke all of Africa.
 
If you make sure everyone dies, you just massively reduced poverty and AIDS and tuberculosis.
It's awesome.
 
And it also increases literacy rates, without having to spend money on schools.
 
@AlfPSteinbach i like your tutorials
xD
 
10:21 PM
> On December 13th, NVIDIA announced that it will open up the CUDA platform by releasing source code for the CUDA Compiler.
And it uses LLVM.
 
Xeo
@RMartinhoFernandes Or don't count Africa when mentioning "the world".
 
nice, I searched that C++ Enthusiast Facebook group for my name and actually found @AlfPSteinbach talking about me
> Johannes gave a nice answer on SO, but an incomplete one: he did not discuss how virtual inheritance would affect the situation. In a sense one can say that his explanation, as given on SO, is wrong, because since it totally ignores the issue of virtual inheritance it would apply equally to such an example, where the same "logic" would produce an incorrect answer... He he.
xD
 
@JohannesSchaublitb We can't. I mean, we could, maybe we could even do it in a way that Iran would never admit because it would be too embarrassing, but still probably not worth it.
 
lol
they prolly already have TEH BOMB somewhere and will throw it on USA xD
 
Angry birds is actually a simulation of an Iranian attack on the US.
2
Using their current technology.
 
10:33 PM
lol
 
who doesn't?
 
So you're all pigs surrounded by wooden blocks?
 
Silly cat. Some are made of concrete, and some are glass.
 
I only played like 5 minutes.
 
my DNA is not particularly ursine
 
10:35 PM
Is pigs surrounded by concrete instead of wood that much of an improvement?
 
Then you have exceptional impulse control.
@RMartinhoFernandes fuck yeah.
 
@DeadMG What are you talking about?
 
@Cat suggested that I was a pig
 
he's yet again confused by references to my posts.
 
You're from the US now?
 
10:36 PM
Somehow I feel like I came out on top when he ignored me.
 
didn't see any US-specific context
 
3 mins ago, by keith.layne
Angry birds is actually a simulation of an Iranian attack on the US.
 
@keithlayne Ah, I totally forgot he was ignoring you!
 
oh yeah, I have him on ignore
 
Haha, joke's on you.
 
10:37 PM
What happen?
I must've missed something.
 
now ask him what GFY means
 
@CatPlusPlus AFAIK, nothing.
 
Lol, that?
 
I seem to recall that he was deliberately wasting my time
 
Anyway, ursine: Of, relating to, or resembling bears.
 
10:38 PM
Don't tell me you really got caught on the GFY thing.
 
WTF has this to do with pigs?
@CatPlusPlus No, the flags got invalidated.
 
hmm, I thought Wiki suggested "ursine" to be what I was looking for
 
for some reason, I don't know the word for pigs in that sense
 
I read that as "urine" first and was bit confused.
 
10:38 PM
I can name a few others like feline, canine, bovine, avian
 
no
 
apparently a joke about charsets is out-of-bounds when you're writing a language with UTF support.
 
I found some use for std::reference_wrapper.
I wonder now if I should include ostream support for reference wrappers to the pretty printer. It seems only fair.
 
the word he's looking for is 'porcine'
 
10:41 PM
Now he'll never know.
 
std::reference_wrapper comes in handy, since you can't make a map of references, can you?
 
guys, is this valid?
 
You can't, but really, do you often need to?
 
10:42 PM
@RMartinhoFernandes you forgot about ManBearPig
 
@RMartinhoFernandes Lol what.
 
@CatPlusPlus: I used it once, can't recall why. I wanted a "copy" of a map, to share the same values.
 
template<typename ...T> struct A { template<template<T> class...X> struct B; };
 
So, a view.
 
Or is it invalid!?
 
10:43 PM
Ahem, All hail George Takei! youtu.be/mvTCr5Z-0lA
 
ursine == bearish, no?
 
Yep.
> Bears and pigs look kind of round from behind.
 
template<int> struct Y; template<bool> struct Z; A<int, bool>::B<Y, Z> *b;
 
like your mom
 
i think "porcine" fits better :)
 
10:44 PM
Dammit, now you spilled the beans.
3 mins ago, by Cat Plus Plus
Now he'll never know.
 
mmmmmm....beans
 
3 mins ago, by keith.layne
the word he's looking for is 'porcine'
 
@MooingDuck Standard library elements have to be assignable.
 
Mr. Beans
@KerrekSB i believe that changed with c++11
 
10:46 PM
So you can't have reference types on the nose. std::reference_wrapper is a value type that wraps reference semantics.
 
they don't even have to be move assignable IIRC
 
@JohannesSchaublitb So it's down to each specific container?
 
i have no idea
but i remember i was fooled in that way too
 
Certainly a vector requires assignable types.
 
and then found that they don't require assignable anymore
 
10:47 PM
I suppose node-based containers don't really need to assign anything
 
@KerrekSB it could depends on the member functions you use
even reallocation doesn't need to assign anything
 
@JohannesSchaublitb Yes, indeed.
So it's down to the actual member functions
That actually makes sense.
 
erase needs assignable (in case you erase from the middle of the vector which of course cannot be found out at compile time)
 
Are references swappable?
 
10:49 PM
@RMartinhoFernandes So you cannot sort a vector of references.
So my wrap trick isn't actually that far off.
 
sorting a vector of reference_wrappers will sort the reference wrapper objects
but based on the order of the referred-to elements
 
Yay
 
that works because of ADL also considers the namespace of template arguments
 
Which is exactly what we need
Though you have to provide the comparison operator, apparently.
Reference wrappers themselves are not directly comparable.
 
if T provides it for itself, reference_wrapper<T> should work automagically
because they provide an "operator T&"
 
10:53 PM
Hm, that doesn't work in GCC4.6.2. Maybe it's a bug.
 
yay, someone posted a question about the CRTP
 
You can try; if you omit the predicate from my code it'll break.
 
pity that the actual problem had nothing to do with it
 
@KerrekSB perhaps std::string's operator< is a member?
it has to be a nonmember of course
 
@JohannesSchaublitb How would that matter?
 
10:55 PM
for ADL to find it
 
1
Q: How to implement the equivalent of Java Generics Self-bounded types in C++ templates

wansteinI have a small collection of algorithms in Java for playing multiple turn-based games, such as TicTacToe, Othello, Checkers, etc. I do it using Java Generics (self-bounded types) to be able to use the same algorithms without having to change them specifically for each game. The reason why I use s...

This?
Java-ification.
Ugh.
 
Isn't there another generic free operator< that looks up the member operator?
Like in std::relops or so?
 
i don't think there is such a thing
 
Yes there is.
 
10:57 PM
In <utility>.
 
since basic_string is a template, they couldn't make use of conversions for the left side anyway
so one major benefit would be lost
however the ADL benefit would still be there :)
 
But that's just to get operator>= and such for free with operator<.
Kinda like a mini-boost.operators.
 
So there isn't a generic operator<(T const & a, T const & b) { return a.operator<(b); }?
 
So Yohannes's original claim about references being magically comparable isn't true in general?
 
10:59 PM
@KerrekSB hmm in fact operator< for basic_string is nonmember
ah now i see
but it is basic_string<A, B>
it would need to be string for it to work
 
How so? string is just a typedef.
 
otherwise there is no trigger for the operator T& call
it cannot deduce A and B from reference_wrapper<std::string>
so it will never come to the point to convert reference_wrapper<std::string> to std::string
BAD NEWS
lol
 
I don't follow - string is a complete and fully defined type
Why isn't that deducible?
 
but for non-template classes it should work fine
 
We're not trying to deduce char
 
11:01 PM
you can start an SO question
others could benefit from the explanation xD
 
(Also, aren't there three template arguments?)
@JohannesSchaublitb Shall I?
 
yes
char type, char traits, and allocator
 
sure why not
 
Ah, I cannot assign to a wrapper either:
int a = 5; auto r = std::ref(a); r = 6;
Though r.get() = 6; works.
 
auto r = std::ref(std::ref(6)) :P
probably fail to compile
 
11:08 PM
0
Q: Why can template instances not be deduced in `std::reference_wrapper`s?

Kerrek SBSuppose I have some object of type T, and I want to put it into a reference wrapper: int a = 5, b = 7; std::reference_wrapper<int> p(a), q(b); Now I can readily say if (p < q), because the reference wrapper has a conversion to its wrapped type. However, with some classes this doesn'...

 
@DeadMG True indeed, the error is that you cannot construct a reference wrapper from a T&&
 
@KerrekSB what for?
 
@KerrekSB perhaps you should point them to the chat log. reading the question it is not clear how you got the idea that this has anything to do with deduction or template instances
 
@curiousguy: teaching
 
11:10 PM
ah wait. you showed the int case
 
@JohannesSchaublitb I'd rather rephrase the question to make it self-contained.
@JohannesSchaublitb Feel free to chip in an edit if you think it's obscure.
 
Xeo
@KerrekSB Ooh, I just ran into that issue some hours ago :D
 
@MooingDuck teaching that it's ambiguous?
 
@KerrekSB @MooingDuck apparently already provided a link in comments
i think that clarifies it
 
@Xeo Did you now -- how serendipitous
 
11:13 PM
@curiousguy: Teaching the details and quirks of the C++ language.
 
@JohannesSchaublitb Mm, I don't like that. The chat log is hardly illuminating... anyway
 
@JohannesSchaublitb: I posted a link as soon as you mentioned it. A self contained question is preffered though, and the comment can be removed if it's no longer needed
 
i see
ur right guys
why does Prasoon recently post questions that have negative scores
what happened to this guy :/
lol
-3
Q: Making is_reference work inside a function template for reference without knowing the type on which the function is to be instantiated

Prasoon SauravHere is the code #include <iostream> template<typename T> class IsReference { private: typedef char One; typedef struct { char a[2]; } Two; template<typename C> static One test(C*); template<typename C> static Two test(...); public: enum { v...

 
@JohannesSchaublitb Maybe he forgot to say that the reply is required fast?
 
11:17 PM
lol
 
Silly, if it was urgent it would be in uppercase.
 
Yay, I have more gold badges than Prasoon.
 
does the order in which people are listed on the gold badge page has any significance?
including for the first few people?
 
It's reverse attribution order.
 
i imagine it could be random among the first few people that already had 1000 upvotes when they introduced the badges
 
11:22 PM
Could be.
 
anyway bed time.
 
Xeo
Ah damn it, I wanted to post my answer after 1am
 
@MooingDuck: If it's all the same to you, why don't you remove the chat link. I think the question is now sufficiently self-contained.
 
@KerrekSB It's all the same to me. link removed.
 
@MooingDuck Yay -- now the wait for The Johannes begins :-)
 
11:28 PM
5 mins ago, by Johannes Schaub - litb
anyway bed time.
I'm sick.
 
@Xeo I can withhold the upvote till after 1 if that matters...
 
Why after 1AM?
 
@RMartinhoFernandes You really think he would let that question go?
 
Oh, right, CET.
 
you know
 
Xeo
11:33 PM
@KerrekSB Yes please, I already wasted +100 rep from this answer :P
 
I actually have garbage collection for my parser
 
Xeo
What?
 
What you mean?
 
@Xeo Thanks for the example -- I was literally just confused over the fact that the comparison operator is only a template. Now it all makes sense.
 
well, I manage the memory of AST types through garbage collection
 
11:34 PM
@Xeo Hah, I can retract my upvote if you don't want it :-)
 
Xeo
@KerrekSB I'm kinda worried that this also removes 10 rep :|
 
@Xeo Hah, lol. You can always recalc.
 
@Xeo It depends if it was a load-bearing upvote.
 
But I doubt it does.
 
Anyway, I can't since you haven't edited.
 
11:35 PM
@DeadMG What GC are you using?
 
Xeo
The repsystem is kinda flawed if you hit the repcap and the votes change afterwards.
 
custom
it's no big deal to write a simple one
 
@Xeo There should be a feature like a "shareware answer": You only see one third now, and to get the full answer you need to upvote on two distinct days.
 
considering the very limited use case
 
@KerrekSB That sounds stupid.
 
11:37 PM
@RMartinhoFernandes Like Commander Keen
 
Xeo
@KerrekSB lol
 
rofl
it's been ages since I thought of that game
I would go back and play it, but... 16bit
 
Ah, wait, so I should be able to get the original question's map comparator going by just specifying std::less<std::string>...
@DeadMG DOSBox -- more fps than Counterstrike
 
lol
curious, they sell it on Steam and don't seem to suggest any problems with 64bit
maybe they recompiled it
 
11:43 PM
No, they bundle it with DOSBox.
That's standard practice.
 
Strangely, while std::sort(v.begin(), v.end(), std::less<std::string>()); works, ...
... what does not work is to add the specialization namespace std { template <typename T> struct less<reference_wrapper<T>> : less<T> { }; } and be done with it once and for all.
Ah, but that's because sort doesn't use std::less<T>
Shame, actually.
 
Can you specialize std::less?
 
@RMartinhoFernandes Of course!
 
I need two more upboats. ;(
 
That's how you can make std::sets and maps
 
11:47 PM
Er, I don't see the connection.
 
@CatPlusPlus Say what?
 
man, memories
 
@KerrekSB There's other ways of doing that.
Like overloading operator<.
 
I think you typically overload operator<, and not specialise less.
 
11:51 PM
is less just a wrapper for operator<?
other than the specializations
 
@RMartinhoFernandes Sure. That's what I'd do most times, too. But maybe that's not always an option.
I don't think there's any restriction in the standard that prohibits specializing less.
I think the only things you mustn't specialize are certain typetraits.
 
why not supply a different comparator then for the 2nd version of std::sort before specializing?
 
mawning
 
@KerrekSB I posted a question, looking for a list.
0
Q: What can and can't I specialize in the std namespace?

R. Martinho FernandesUsers are allowed to add explicit specializations to the std namespace. However, there are a few types that I am explicitly forbidden from specializing. What types can and can't I specialize?

 
@RMartinhoFernandes Haha!
I'm pretty sure the standard has a chapter on this
 

« first day (424 days earlier)      last day (4521 days later) »