« first day (421 days earlier)      last day (4534 days later) » 

Xeo
12:00 AM
How so?
 
what is ambiguous is <T, U, V...> compared against <T, U>
i.e if the only difference is a trailing pack expansion
 
Xeo
@KianMayne Forgetting the http://?
 
to make it unambiguous you would need to "overlay" the pack expansion with a fixed parameter in the other template
like <T, U, V...> against <T, U, W>
 
@Xeo Didn't just then
 
Xeo
@KianMayne Oooh
You need it the other way around. :P
[text](link)
 
12:01 AM
but really, this is unintuitive and so it will probably (hopefully :)) be changed by a DR. let's see...
 
OK So you need a page rather than a domain so it's [test] (link.uk/page.html) (without the space)
 
in any case, the question is correct that as defined, the common_type template is illformed
 
Xeo
@JohannesSchaublitb But isn't that tested with a transformation to a function and partial ordering? And the comments to that partial ordering suggest that non-variadics are more specialized than variadic templates
 
@Xeo please show such comment
 
Xeo
I did in my answer
 
12:03 AM
the text you show demonstrates a "<T, U, V...> against <T, U, W>" case, which is unambiguous
but common_type has a "<T, U, V...> against <T, U>" case
 
Xeo
Ah, I see for the second quote now. Yeah, that's something different...
In the quote it's actually "<T, U...> vs <T, W>"
you confused me with that third parameter :P
But wait, that shouldn't matter if you give or take a constant (in this case the parameter)
"<T, U...> vs <T, W>" and "<T, U, V...> vs <T, U, W>" should be the same in that regard
 
yes they are
both are unambiguous
 
Xeo
Okay, I think I cleared the misunderstanding in my head now
 
the problem is only when the "U..." has no corresponding fixed parameter on the other template
 
Xeo
We want a disambiguation between "<T, U...>" and "<T>"
 
12:07 AM
indeed
 
Xeo
That makes my answer moot
Damn :(
 
lulz
BAD NEWS :(
 
user406009
Hey, what is the name of this symbol '*'. I know it is the deference operator.
 
user406009
I am trying to answer a question, and I am resorting to" just add another *"
 
@EthanSteinberg Asterisk? Star?
 
12:09 AM
it's an asterisk
 
Xeo
So, and all that could be fixed with a little "non-variadic templates are always more specialized than variadic templates."?
 
you can call it asterisk
 
Xeo
@EthanSteinberg Uhm... "star"? "asterisk"?
Btw, how does one take a snapshot of the chat and link it as a discussion?
 
@Xeo the intent originally was that <T, U...> vs <T> should behave like a function call.
 
anyone know why my return function in a nested try/catch block not returning out of the function?
 
12:10 AM
the U... was thought of as being parameters with default arguments
 
Xeo
So it should just be ambiguous
 
if you take that route, then it is ambiguous because void f(T, U = N); vs void f(T); is ambiguous as well
 
Xeo
Hm, I certainly like my route more
 
but as it now turns out, it seems to be too unintuitive :)
 
Btw does anyone know of any website where normal people post program ideas?
 
Xeo
12:11 AM
@KianMayne Try project euler
Some self-exercise
 
Normal people? What's wrong with weird people's ideas?
 
try{
dynamic_cast
} catch (bad cast){
try {
dynamic_cast
} catch( bad cast){
return 0; //not returning 0, but going to the end of the function
}
}
//goes to code here
 
Xeo
And I have to admit, standardese can be quite complicated to follow..
 
@Xeo it can be fixed by erasing the parts that make this ambiguous
various paragraphs were inserted that are responsible for this :)
 
Xeo
@JohannesSchaublitb If only I knew which parts those are... I can't really tell what those paragraphs in [temp.deduct.partial] mean... too much complicated standardese :(
 
user406009
12:15 AM
@Kain Here is a good program idea. Create a file transfer program. Good opportunity to learn how to deal with the mess that is known as networking. You need a whole command network(tell clients what files are available, client tells server it wants a file, etc)
 
@Xeo the change that made this ambiguous is "Change 14.8.2.5 temp.deduct.type p9 and p10 as indicated:"
 
Xeo
@JohannesSchaublitb I gotta admit, I don't understand why f<int>(42) is ambiguous in the first example they added
 
@Xeo i haven't used the rules a lot either. so i don't know off the top of my head :)
@Xeo but in that case it is ambiguous because "In the context of a function call, the types used are those function parameter types for which the function call
has arguments"
in this case, the only type that has arguments is "(T)" (the second parameter has a default argument)
 
Xeo
Maybe it would help to understand that P and A stuff first, and all those forms..
 
Xeo
12:23 AM
But I think I understand now why that made it ambiguous
 
@Xeo it may also help to see the first proposed resolution: open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#692
note that there it was proposed "During partial ordering (14.8.2.4 [temp.deduct.partial]), if Ai was originally a pack expansion and Pi is not a pack expansion, or if P does not contain a template argument corresponding to Ai, argument deduction fails." so in both cases, deduction of the "T..." template against the other template fails, regardless of whether there is a corresponding fixed type or not. the newer wording did only make it fail if there is a corresponding fixed type.
 
Xeo
f(A<int, T...>); #1
f(A<int>); #2
// #2 "does not contain a template argument corresponding to A0", so A0 is ignored
 
exactly, that's what makes it ambiguous
 
Xeo
And with the wording you just quoted, #2 would be selected, right?
Or do I still misunderstand that?
 
yes, then #2 would be selected
 
12:28 AM
I think I'll solve the problem we had in a quiz the other day
It was like
 
Xeo
@JohannesSchaublitb Oh, wait, isn't that SFINAE kicking in and taking #1 out of the overload set?
 
@Xeo if a pack cannot be deduced otherwise, it will end up being deduced as an empty pack
 
abcdefghi (not multiplied, concatenated) / 9 = an Integer
abcdefgh / 8 = an integer
abc / 3 = an integer etc
 
@Xeo 14.8.1p3
 
Xeo
@JohannesSchaublitb Under the current rules or under the proposed ones?
 
12:31 AM
under current c++11 rules
there is not anymore any actively discussed proposal about these things.
i'm sure that will change at the next meeting though :)
 
Xeo
Ah, I meant that under the proposed ones, SFINAE would kick in, since deduction fails, and deduction (substitution) failures are no errors, so #1 would be taken out of the overload set
Atleast that's how I understand it, could be wrong again though
 
@Xeo the purpose of deduction failing is to make the template more specialized
in this case it is not the purpose to trigger SFINAE
partial ordering is just "let me see if when i take my parameter list and try to match it against that other template, deduction fails. if so, then that other template is at least as specialized as me!"
@Xeo during the argument deduction for overload resolution, the rule is not active because they begin the rule with "During partial ordering ..." :)
 
Xeo
@_@
@JohannesSchaublitb And if deduction succeeds?
 
then we all die
 
Xeo
:(
And in a serious response? This is the point I don't quite seem to get.
 
12:46 AM
i was talking wrong.
it actually says " If deduction succeeds for a given type, the type from the argument template is considered
to be at least as specialized as the type from the parameter template." xD
 
Xeo
And if it fails, it's less specialized
 
i guess it makes a difference somewhere
if it fails then it is not at least as specialized xD only if the other direction deduction NOT fails then it is less specialized =)
 
anyone know the difference between _ and ^ in vim?
 
@Xeo ah wait, NOPE!
 
Xeo
@JohannesSchaublitb Okay, wait a second... where is the difference between "not at least as specialized" and "less specialized"?
 
12:49 AM
it's more complicated it seems
so better I'm stop talking now and only talk about it when actually needing it xD
otherwise people will quote my nonsense and i will responsible for spreading lies into the air
 
Xeo
Can you still answer my last question please? :)
 
@Xeo since it is a partial order, it may be neither more, less nor equally specialized.
 
Xeo
Ah, so it may be entirely out of the window?
 
i think if deduction fails in both direction, then this case happens that there is no order at all
but i may again be wrong
 
Is there a better way of checking if something is an integer besides saying
double x = 5.345;
if(ceil(x)==x)
{
return true;
}
 
Xeo
12:53 AM
So, I have 20.001 rep. Who wants a downvote?
2
 
user406009
@KianMayne You mean checking if it is a whole number?
 
you can always downvote questions without loosing rep
 
@EthanSteinberg Yeah
 
@Xeo i don't think it is a surprise that partial ordering has different behavior between all compilers xD
 
Xeo
@JohannesSchaublitb No, and I'm certainly stumped how the committee sees through all that clutter
 
12:58 AM
@JohannesSchaublitb i don't think you get the ocd'ness of the question. that extra 1 rep is annoying :)
 
Xeo
So, I could swear I saw a similar question to this some days ago
0
Q: Creating a byte out of 8 bool values (and vice versa)?

xcelI have 8 bool variables, and I want to "merge" them into a byte. Is there an easy/prefered method to do this? How about the other way around, decoding a byte into 8 separate boolean values? I come in assuming it's not an unreasonable question, but since I couldn't find relevant documentation vi...

But for the heck of my life, I can't find it
 
@Xeo When I passed 20k, I had exactly 20,000 for like 4 seconds...
 
I tried to get a screenshot...
 
i once had 1337 rep
 
12:59 AM
then... too late
 
or was it 13370
dunno anymore
 
Xeo
@Mysticial Why did you press F5 :P
Still no F/Z from UTW...
 
I was clicking to my profile
and the the back button did a refresh
so I ended up getting my screenshot at 20,020
It was another one of those fast questions where you get like 5 upvotes in 20 seconds if you're the first to answer... so that's what happenned
 
lol
@Mysticial did you try removing an answer with 2 upvotes and trigger a recalc at /reputation
 
Xeo
@Mysticial I hate those. You answered one of them earlier and by the time I pressed "Send" you had 5 ups :(
 
1:02 AM
my rep-recalc isn't divisible by 10
 
@Xeo part of reps is to be FAST
so always be fast and then update the answer in the 5 minute frame
that's simply part of the game!
 
Xeo
Yeah, but it was like 2 seconds!
 
there's a 41 point descrepancy between my visible and actual rep
*39 point
 
Xeo
I have to account for the 30 sec update window though it takes to show that "new answers" line
 
@jalf I just read this answer - thanks!
 
1:04 AM
i don't like when my answer is edited by someone in the 5 minutes frame becasue that causes the "edited" label to appear xD
 
user406009
And watch as an answer with bit flipping wins when the best solution would be to abstract away all of that nonsense and just use a std::bitset ...
 
Xeo
Aww :>
 
hmm?
 
I also find it hilarious that random extremely basic questions will hit like 50+...
 
Xeo
It's always the basic ones
 
1:05 AM
lol
 
Xeo
Because those are the ones the most people understand
 
@Mysticial Well, there are a lot of people who benefit from answers to the basic questions
and there are a lot of people who are able to answer them
 
*true, but they don't hit 100+ very often
 
hence, there are a lot of people willing to upvote them
 
usually, most of the 100+ "short" questions tend to have a catch to them
the best recent example being the Trigraph question.
 
Xeo
1:08 AM
Trigraphs ftw
Best obfuscation method ever
if(a ??!??! b){ ... }
 
one of these days
I'm gonna write a script that will replace every single ||, &&, etc... with a trigraph
 
Xeo
Best thing about them: You can't search for them if you don't know their name :)
 
exactly
 
Xeo
Damn, there is no trigraph for &...
 
no?
oh right, it's under the numbers
 
jli
1:12 AM
@Xeo also (a?b:c)=(b?a:c);
 
Xeo
int??? a = ...; - SO question: "What does '???' after a type mean?"
Hm
struct foo{
  ??-foo(){}
};
 
:)
 
jli
int a??(10??)
 
Xeo
@jli I like int a<:10:>; more, mischeavously grinning smileys left and right
 
jli
lol
There should be a trigraph for ;
And a trigraph for ?
So you could have nested trigraphs
 
1:17 AM
Do trigraphs work in C++, or did they take them out?
 
Xeo
@jli Err...
@jli Infinite recursion ensuring
 
jli
Yep
 
Xeo
@Mysticial Sadly, they do work
 
I'm struggling to find an efficient way of doing this that doesn't involve 9 nested for loops.
 
Xeo
Though MSVC doesn't support them afaik
Yeah, it doesn't
 
1:18 AM
lol
 
Xeo
Digraphs too
 
There was recently a digraph question.
It didn't make it past 10 votes.
 
jli
@Xeo What is the ??? trigraph?
 
and if I recall correctly, nobody linked to that big trigraph question
 
jli
Is it actually one?
 
Xeo
1:20 AM
@jli It doesn't exist, I took it as a placeholder for &
 
jli
I see
 
Xeo
because sadly, & doesn't have a trigraph
 
how did we get to this topic anyway...
 
hello
 
jli
lmfao $ g++ -o test.o test.cc
test.cc:1:1: warning: trigraph ??= ignored, use -trigraphs to enable
 
1:23 AM
lol
 
jli
"voluntarily removed by its author"
You and your rep.
 
hilarious trigraph fun
 
Is there no keyword for address of &?
 
@jli what do you mean
 
1:24 AM
+4/-9, wow
 
jli
When I go to that link, it says Page Not Found - voluntarily removed by its author
 
10k+ only
 
jli
Exactly
So I said "You and your rep."
 
Ok, i have read about this C++ puzzle. What do you think will be the output? Happy puzzling!

int main() {
int x = 1;
for(int a=0; a<10; a++);
// what happens with x?!!??/
++x;
std::cout << x << std::endl;
}

This wasn't easy to solve! Here's where i got it from: http://www.gotw.ca/gotw/086.htm

Before you downvote, comment on why you do so! I think this puzzle is some good information on a C++ pitfall.
(Some people downvoted this, since they thought the problem was because of the ';' after the for loop. But actually that was just the minor problem here)
 
jli
I see
 
1:26 AM
i added all text starting with "This wasn't easy..." afterwards when they blamed me saying i would spam
 
Xeo
@Mysticial, do you read any manga online? (I think I already asked you this question)
 
I actually don't read manga at all
you can check my MAL
it's the same as un as here
 
Xeo
Ah, such a pity! New Negima Chapter is hilarious again :)
 
mainly cause reading manga actually requires my full attention
whereas anime I can just throw on my 3rd monitor and let it run while I do other things
 
    int usedNums[];

    for (int a = 1;; a++) {
        resetUsedNums();		//Does what it says on the tin.
        usedNums[0] = a;
        for (int b = 0;; b++) {
    	if (isAvailable(b) && ((((double) a + (double) b) / 2).ceil) == (a + b) / 2)
    	    )			//isAvailable returns a false if the number isn't the same as any number in the usedNums array
    	{
    	    for (int c = 0;; c++) {
    		if (isAvailable(c) && ((((double) a + (double) b + (double) c) / 2).ceil) == (a + b) / 2)
{    //etc    }
 
1:29 AM
There are quite a few shows out there where you really don't need to read all the subs to know what's happenning...
 
Tell me there's a better way of doing this (there's 9 numbers)
 
there should be a number on each user page how many times they viewed their own user page
so that one can better understand why a particular user has a high view count :)
 
Xeo
Do your own visits even count?
 
I don't think so. I visit my activity and rep pages probably some 50+ times in a day, and that counter definitely doesn't go up by that much.
 
1:36 AM
hmm
 
oof, my lib is running like crap on my mac.
about 3 times slower than my 4-year-old windows laptop
It also segfaults on one of my benchmarks. I guess that should be given priority...
 
@Xeo What's your MAL? (assuming you have one)
 
Xeo
Same nick
 
cool, found ya
 
Xeo
I'm mostly reading mangas though. I find anime to be more time consuming^^
 
1:42 AM
lol, exact opposite for me...
 
Xeo
Well, I have to watch the screen for the subs since I just don't understand japanese :P
 
Anime compatibility unknown? bullshit...
 
Xeo
I don't rate my anime / manga
 
oh...
I obviously haven't clicked through yet
 
Xeo
It's proven to be difficult, so I dropped that
 
1:45 AM
And the only one you did rate, I haven't rated yet...
lolz
 
Xeo
Oh, I actually rated one?
Oh, right, F/Z. Because it's epic, I leave the rating until the season is over
And since I already read the Light Novel, I know it's going to continue being epic
 
that's another reason, why I don't read manga - it tends to spoil the anime...
 
Xeo
I like to watch Anime I've read the manga of, because I can see all the action in... well.. action. Moving and stuff
There are also many awesome manga which do not have an anime adaption
 
we have a lot of anime in common - or maybe because I've been watching half the shows of the past like 10 seasons...
 
Xeo
Or which are just plain more epic in the manga version
As you can see, I can't even seem to finish the epic anime from the last seasons. :P Steins;Gate especially
 
1:50 AM
yes, Steins Gate is epic... last 3 episodes especially
having watching them as they came it out
those 1-week waits were almost as bad as the 1+ month wait for Madoka 11 and 12
 
Xeo
I'm glad I didn't have the 1 month wait between each katanagatari episode
Because those had a very high tendency to have an epic cliffhanger
Especially episode 11
 
That's on my to-do list which I haven't gotten around to yet...
lol
 
Xeo
By the end of episode twelve, you'll find yourself passed out in some alley with a fan-shirt on
 
speaking of which... I went to ACen stupidly expecting to be able to get a Madoka wallscroll...
nope... too early, especially after the earthquake
 
Xeo
:/
 
1:54 AM
I was supposed to go to AX as well, but the Kalafina concert tickets sold out and the rest of my buddies bailed on me... so... damn... nope
 
Xeo
I don't have the money to go anywhere
Hm, 3am and I'm just staying awake waiting for F/Z...
 
For me, I go to school near Chicago, so ACen is a given. I have buddies who also went to school here but live in LA - so it'd just be a short flight to LA for me...
 
Xeo
Europe :s
 
oooh... that sucks...
 
Xeo
All we got here is the Connichi and some other event I can't remember right now
 
1:58 AM
My undergrad buddies are trying to organize a 2012 comiket run in Tokyo...
price tag: $1700
 
Xeo
Ouch
 
we're all crazy fanatics anyway... Yes 1700 is high, but that's actually pretty cheap considering it's Japan. The guy organizing it really knows how to find these deals.
 
Xeo
Ooh, some good AMVs came out again since I last skimmed through amvnews.ru..
 
hey
where do I go for c++ related questions?
 
Xeo
Try the C# room
 
2:06 AM
nice...
 
but that's not even
 
As you can see, even though this room is "Lounge<C++>", it can get pretty off-topic...
 
user406009
Just ask and people will answer
 
wasn't sure if there was another one, Mysticial
 
But, yes, you're in the right place.
 
2:09 AM
ok, question. I'm playing with different kind of casts now they work
and I can't build code that casts derived class to base class
thats dynamic_cast
 
cast pointer/ref, not the actual object
 
Xeo
That doesn't need a cast
Derived* pd = ...;
Base* pb = pd; // no cast required
 
casts pointer to object of derived class to pointer of base class object
 
Xeo
Dynamic cast is the other way around
base to derived
 
what a mess
 
Xeo
2:12 AM
How is that a mess?
 
ok I'm actually trying to upcast base class object with dynamic_cast
 
Xeo
dynamic_cast if you don't know the actual derived class type, test for the returned pointer != 0
static_cast if you know all involved types at compile time
 
dynamic_cast is silly
 
Xeo
reinterpret_cast if you feel brave, don't use it
 
the compiler won't even build the code for me, it tells me that error: cannot dynamic_cast ‘ (of type ‘class ’) to type ‘class ’ (source type is not polymorphic)
 
Xeo
2:14 AM
const_cast if you want to add or remove const and/or volatile
 
const_cast is silly
 
Xeo
The base class needs at least one virtual method
for dynamic_cast to work
@Pubby It's not
Explicitness is a great thing
@Pubby And this is wrong to, on what do you base this?
 
what's a non-silly use for const_cast?
 
Xeo
casting away constness
or adding constness to this to call a different overload
any cast where const or volatile is involved
 
casting away constness defeats purpose of const
 
Xeo
2:16 AM
No, not if you know that the original object is non-const
There are legitimate uses
But I'm not going to discuss them now, there should be examples on SO
anyway, afk watching some AMVs :)
 
friend explained it to me that const is more of protecting programmer from writing bad code than protecting data from bad code
@Pubby
more about
 
2:34 AM
what the hell
shouldn't failed dynamic_cost throw an exception?
oh, that's only for reference casts
 
user406009
2:46 AM
Is there added cost to dereferenceing a boost::shared_ptr?
 
Xeo
Theoretically yes, practically no thanks to inlining
 
user406009
Good. That works well enough for me.
 
It's possible I edit the second bit in a integer, for example: int x:1 ??
 
@BrunoAlano you mean like bit fields?
 
Yeah
 
user406009
2:59 AM
Yeah it is possible and there are at least 3 good ways to do it. What are you trying to do?
 
Nothing, but I don't know how works
 
jli
It bugs me that this is valid C++ (when $ is allowed as an identifier, like my version of g++ allows) pastebin.com/MmJyZNJN
Bonus points for figuring out what that does
 
@Bruno mostly & and |
 
user406009
But Bruno, if you only want a bitset or bitmap, then use std::bitset.
 
What @Pubby ??
Hm
Thanks
I will learn
 
3:03 AM
Sup, 4AM people.
 
jli
Hey
10 PM here
 
10PM, huh. So that's...
GMT plus something.
I'm no good at math now.
 
jli
EST
Which is -5
 
I knew that. Almost.
 
jli
@CatPlusPlus Does it bug you that this is valid C++? pastebin.com/MmJyZNJN
And that is actually a useful program, somewhat.
 
3:07 AM
Meh, preprocessor. You could do a non-standard preprocessor that allows for even less sensible input.
It's valid, but nobody does that, unless they want to deliberately obfuscate stuff.
And you can do that in any language, really.
 
jli
Let's see that in haskell..
Actually
Never mind Haskell's pretty bad for that.
 
$ is valid as identifier in Haskell.
Dunno about starting with _
 
jli
It's hard to obfuscate in brainfuck
 
Brainfuck is obfuscated by design.
 
jli
Thus, any attempt at extra obfuscation fails.
Since it's just about as unreadable as it was before obfuscation.
 
3:10 AM
Well, you could do a preprocessor that flips the meaning of operators. :P
 
jli
This is true..
 
Xeo
@Mysticial
F/Z by UTW is out
 
 
2 hours later…
5:40 AM
@Xeo what does that mean
I am pleased with final (?) version of the blog posting that I invited comments on yesterday
 
@alf I read it a little while ago and it blew my mind...couldn't believe you would have to do all that to have main() as the entry point
 
@keithlayne only with MS tools (e.g. not with GNU), and only for GUI subsystem applications (e.g. not for console). However, nearly all Windows apps are GUI subsystem apps developed with MS toolchain... :_)
 
makes me wonder if there's a good way to do portable gui C++ at this point
the more I read about its memory management, the less attractive Qt looks to me
well, bedtime for me. You should get that blog added to the room feed as well. It's a topic of which I'm woefully ignorant.
 
sbi
6:02 AM
@Xeo Oh, round numbers?! Who wants 6,941 downvotes?
 

« first day (421 days earlier)      last day (4534 days later) »