« first day (870 days earlier)      last day (4087 days later) » 

6:00 PM
@MooingDuck chat.stackoverflow.com couldn't be resolved at all.
 
Xeo
@MooingDuck You can't just expand T(args)... anywhere, though.
@TonyTheLion How could it?
 
@TonyTheLion compilation error, passing too many parameters to a function
 
Xeo
args... is a, b ,c
 
@Xeo I'm assuming f() has a defined number of args
oh, I see
so in the end how do I get to the individual elements in Args...?
because you've got to be able to get to them, else what is the point?
 
alright
that wasn't too bad
 
6:01 PM
hehe
 
@Mysticial There is a for loop in there, the code formatting is just so terrible that it shows up on my neighbour's TV instead of my screen. — us2012 36 secs ago
 
@TonyTheLion usually you do an operation on all of them, or forward to a function that extracts the params you need. void bar(T first, T...rest) calls itself recursively to extract them.
 
ah right
 
Xeo
@Mysticial LOL
 
Usually you use indices.
 
6:02 PM
I have a few design questions regarding string literals in ogonek. Anyone up for it?
 
Too lazy to provide working example? :) — Vlad Lazarenko 3 mins ago
meh
I'm trying, aren't I?
 
Xeo
Poor lion.
 
@R.MartinhoFernandes You really like ogonek.
 
@ScottW yeah
 
@R.MartinhoFernandes Not tonight I'm afraid.
 
6:03 PM
@DomagojPandža It's my hobby project...
I don't see why I should not like it.
 
@TonyTheLion usually, if you need to get at them, you use actual parameters. You only use variadic templates if you're going to take a "list", and do the same operation on each element of the "list".
 
@R.MartinhoFernandes SUre.
 
(or for metamagic)
 
@MooingDuck ah I see, I think that makes sense
 
I just love when people tell my that my payment requisition was placed just a day after the final ones have been processed. How convenient for them. Well, I'll guess I'll survive for a couple of more hours.
And these Twitter emails saying me to take two minutes and check something out should suck my dick and fuck off.
 
Xeo
6:06 PM
@MooingDuck I wonder if "TMP" would be a plausible metamagic feat. /cc @R.MartinhoFernandes
 
@Xeo not sure what you just said, but my second interpretation was DnD3.5
 
Xeo
Shoo, shoo, bad owning raw pointers, shoo! — Xeo 5 secs ago
@MooingDuck :)
 
"Too many emails? Sorry about that.
You'll no longer receive resurrection email notifications."

Many thanks, Twitter.
 
What are min reductions?
 
6:08 PM
also, was @Rapptz the one a day or two ago who said he didn't know boost and gave an answer where the correct answer would have been boost::assign?
 
@TonyTheLion A reduction but with the min operator as opposed to +, *, and such.
Reductions can be performed on any associative operation.
 
I don't know what a reduction is
:|
 
@TonyTheLion Oh, summing up an array would be an add-reduction.
 
Xeo
fold, accumulate
 
    text32 foo { U"foo" }; // this one should definitely compile
    // only one can hold true
    REQUIRE(foo.storage().size() == 3);
    REQUIRE(foo.storage().size() == 4);

    char32_t array[] = { U'b', U'a', U'r' };
    text32 bar { array }; // and now what?

    char32_t const* ptr = U"qux";
    text32 qux { ptr }; // I think this should compile too
    // I have more, but later
 
6:08 PM
The case of the disappearing waste basket.
 
user142019
> Social media has overtaken pornography as the #1 activity on the Web.
 
user142019
lololol
 
@Mysticial ah I see
 
@R.MartinhoFernandes size() shouldn't include the NULL terminator, so definitely size() == 3 in the first instance.
 
Xeo
6:10 PM
@R.MartinhoFernandes 3, do as string does and say it needs to be null-terminated, only take pointers and optionally a size?
 
I agree with the puppy.
 
@DeadMG size is from std::string so it doesn't. The question is whether I should or should not put the null-terminator in the storage. (i.e. "foo" or "foo\0")
 
as for #2 and #3, you can get #2 with a T(&)[N] constructor, and the second by assuming NULL termination.
@R.MartinhoFernandes Definitely drop the null terminator whenever possible.
 
Oh. God. What the... Am I missing something here, or is the OP being exceptionally thick?
Huh. Derp. Wat. My code doesn't derive $net - I treated it as a given. Exactly like your code did. The only three lines required are the top three. I'm sure you'll be able to work it out. See this pastebin spelling it out: http://paste.ubuntu.com/5585785/sehe 1 min ago
 
@DeadMG How do you distinguish #1 from #2?
 
Xeo
6:11 PM
@R.MartinhoFernandes You don't. Unfortunately. :(
 
@R.MartinhoFernandes You check the storage?
 
Xeo
As I said, just take a pointer.
 
@EtiennedeMartel I mean, if they are to have different behaviours, how do I write the overloads to distinguish them?
 
@R.MartinhoFernandes What does size() return?
 
@R.MartinhoFernandes why do they have different behaviors? What's going on?
 
Xeo
6:12 PM
And assume the string to be null-terminated.
 
@EtiennedeMartel It's from std::string.
 
@MooingDuck and @others A perfect answer would compare the syntax method(ilist<T> i) and method(T... i) . It may be difficult to compare the two, perhaps only a member of the committee can describe the decision.. I already see some pros and cons of both - also due to your help. I am still waiting for a answer, that future visitors could read and be convinced: 'yes, now I understand why. It's a good choice.'
 
@R.MartinhoFernandes So you just delegate the work to the storage?
 
int fold(std::vector<int> v) { int result = 0; for (auto it = v.begin(); it != v.end(); ++it) { result += *it; } return result; } This?
 
@MooingDuck Assuming the assertion that holds is size() == 3 in the first one. (i.e. one assumes "null-terminated string" is the input, the other assumes "array of code points")
 
Xeo
6:12 PM
@TonyTheLion Yea
 
@R.MartinhoFernandes ah, I see
 
@R.MartinhoFernandes when taking const T(&)[N], check if the last digit is null?
 
@EtiennedeMartel Yeah, but the question is what to put there.
 
Xeo
@elmes Try passing a T... around or build an interface against it.
 
6:14 PM
@R.MartinhoFernandes Does the Unicode standard mandates anything when it comes to length?
 
@R.MartinhoFernandes Also your examples are distinguishable (const), but your points stands.
 
Because size() should definitely return the length of the text.
 
@Xeo Suppose that method(T... t) { other_method(t); } works.
 
@EtiennedeMartel It's size() of the storage, i.e., advanced interface.
 
@sehe, do you have a recommendation for a rackmountable, fanless gigabit switch?
 
6:15 PM
@MooingDuck "the correct answer" - gah. Try "a very useful answer" on for size :)
 
@R.MartinhoFernandes Oh, so if you use UTF-8 over a vector<char>, you'll get length in bytes?
 
@bamboon Nope. I don't own any server grade hardware
 
Xeo
@elmes template<class... T> struct X{ void foo(T... v); }; // what now
 
@EtiennedeMartel Yeah. But notice it's not text::size, it's vector::size.
 
@EtiennedeMartel foo.storage().size() seems clear to me
 
6:16 PM
Oh, wait.
I've been reading the whole thing wrong.
 
@R.MartinhoFernandes Just check if the last element is a null. If so, reserve container (if necessary) and delegate to null-terminated pointer constructor.
 
@Xeo It doesn't have to be a variadic template. We're comparing a new container with new syntax, where the syntax is not defined prefisely - it doesn't exist ;)
 
Anyone wanna look at the problem here? stackoverflow.com/a/15169162/85371
 
Xeo
Robot~ text(T const* p) for the literal, assume null-termination - text(T const* p, size_type N) for the array case, don't assume it.
 
@Xeo oh... right.
 
6:17 PM
All in all it seems that the committee simply chose the simplest solution: let's add a new type and we're done. boom.
 
char32_t array[20] = {};
array[0] = U'b';
text32 bar { array }; // and now what?
 
@Xeo So no T(&)[N] constructor?
 
@MooingDuck How do you distinguish it on the type system (assume I declared array const).
 
Xeo
@DeadMG It's just not worth it. It's always going to be inferior to the T const* p one anyways, according to overload resolution.
 
@R.MartinhoFernandes You can't- there's no distinguishing between a string literal and a regular array.
 
6:18 PM
okey. Battle.net finally started giving us opponents from Diamond
 
Xeo
@DeadMG I think that's what he wants the duck to realise.
 
@R.MartinhoFernandes I misspoke, but it should be as Xeo said
 
In overload resolution, the compiler prefers a nontemplate over templates right? If two generate the same function.
 
@TonyTheLion Yes, but that is only if they are otherwise equal matches.
 
@TonyTheLion if the nontemplate is an exact match for the type, including const and volatile.
 
6:19 PM
right
 
template can still be a stronger match and get called, even if a nontemplate could be called.
 
Don
What do this line do? dot(dir,dir);
 
dots the dirs.
 
Ell
calls the function dot with the arguments dir dir :3
 
Don
So if dir is actually a vector of x,y?
 
6:22 PM
@Ell not if dir is a type :P
 
Xeo
@TonyTheLion Your answer doesn't answer the question, which asks why overload resolution apparently comes before argument deduction. The OP is misunderstanding something here, though.
 
@Don what?
 
Ell
@MooingDuck even if dir was a type, what could it do?
 
@Xeo I was looking in the standard.
 
@Ell declares a function: most vexing parse
 
Don
6:22 PM
@MooingDuck Like so: vector dir = player.pos() - obstacles.pos();
 
@Don I don't see how that connects in any way to dot(dir,dir);
 
My guess? Dot product of vectors.
 
Ell
@MooingDuck Oh yeah
 
@EtiennedeMartel So it's that game where I have to guess whether it's the Onion or not right?
 
6:24 PM
@Don you're very confusing. If you have a question about code though, this is not the room for it. Questions go on the stackoverflow main site.
@LucDanton totally the onion
 
No, not enough profanity in "fuckin' bitchin' quotes", said the reporter.
 
Don
@MooingDuck I got that code on an answer but.. I don't really understand what the hell it does lol
 
@Don needs more context, can you link to it?
 
It's dot product. Dot product over itself is the square of the length.
 
6:26 PM
@MooingDuck Not the Onion, but close.
 
@Xeo FTR, except for directly passing a container, whatever I allow in constructors I want to allow in op=, assign(), append(), insert(), and replace(). The two param one annoys me a bit because it means moar overloads :/
 
@Don yeah, since dir is a vector, I'd guess he means a dot product. Ask him to be sure.
 
Leaving now. Will be back with more string literal annoyances.
 
@Don So, you're doing vector math but you don't know what a dot product is?
 
is make always single-threaded unless you invoke it with -j?
 
6:27 PM
@EtiennedeMartel But it's true! :D
 
@EtiennedeMartel he was doing geometry and someone gave him a dot product answer.
 
@MooingDuck Woooops.
 
Xeo
@R.MartinhoFernandes Welp, nothing much you can do about it.
 
It's like CompSci is your co-driver.
 
Xeo
You could also just go with some basic_string_ref intermediate type and let that deal with the two overloads, which would reduce your stuff in half.
@DeadMG I think so
 
6:29 PM
might explain why it's taking so long to build
 
user142019
f.lux is awesome.
 
user142019
f.lux <3
 
Ell
It sucks.
Well it doesn't suck probsies, I just didn't really find it did much :P
 
user142019
I like warm colors.
 
user142019
Otherwise colors are so cold and blue-white-ish meh.
 
Xeo
6:37 PM
1
Q: There seems to be a contradiction in the book "C++ Templates - The Complete Guide"

user1042389In Section 2.4 Overloading Function Templates of the book "C++ Templates - The Complete Guide" you'll find the following example : // maximum of two int values inline int const& max (int const& a, int const& b) { return a<b?b:a; } // maximum of two value...

I like how everyone ignored the actual question of why argument deduction has to happen before overload resolution... everyone just jumped on the "non-template is a better match than template" wagon.
 
that's because "Why didn't the compiler pick #2" is the implicit question.
he doesn't actually ask why argument deduction occurs first.
 
Xeo
> According to (2), ::max(7,42) should call max<int> by argument deduction.
Contains the basic misunderstanding, that "argument deduction" is some other form of overload resolution that happens before the actual overload resolution.
Is what it seems like to me, anyways.
 
I changed my answer
 
Xeo
0
Q: Why does iterator type deduction fail?

MehrdadWhy does this not work in C++? Why can't I restrict foo's parameter to std::vector<T>::iterator like this, and what is the best workaround? #include <vector> template<class T> void foo(typename std::vector<T>::iterator) { } int main() { std::vector<int> v; ...

Wouldn't expect this question from @Mehrdad.
Now, where's our dupe for this...
 
I am passing this to my lawyer. My privacy was badly affected since now questions asked by one user were merged into the old account. What would happen if I take all my questions and stick into your account? You cannot deliberately merge two different account without the explicit user consent. Anyways... If you have good lawyers then continue to do it. — Astonished 14 mins ago
^^ holy shit...
 
Xeo
6:43 PM
Close votes for the above question please.
 
@Mysticial seriously?
 
Xeo
@Mysticial Nutjob.
 
What.
So, what, he wanted to ask crap questions anonymously without affecting his reputation?
 
Xeo
Shoo, shoo, bad no-make_unique, shoo! ... Just kidding. ;) — Xeo 7 secs ago
kek
 
@Astonished Why did you want to have multiple accounts? — Etienne de Martel 1 min ago
Am I the only one who thinks that's weird?
 
6:47 PM
I've given many fucks in my time. Nowadays, it is hard.
 
Xeo
Crap. Craaaap
The super market will close in 10 mins. :(
 
Xeo
And I don't have any foodz here.
Brb!
 
Xeo
Fight my comment fights for me!
 
6:48 PM
@EtiennedeMartel He's claiming it's about preserving his privacy. I'd guess it's more about being able to anonymously pass prospective employers' question through to SO, while string out "yeah, I'm an expert in that area", for long enough to get an answer he can pass off as his own. Maybe I'm just cynical though...
@DomagojPandža Being hard is kind of a necessity for giving a fuck.
10
 
@JerryCoffin That could be it.
 
hmm
are there magic variables on Linux known as CC and CXX?
I was told to set them but not how or where
 
@JerryCoffin Wait, how would that work? I'm confused on how someone might abuse this to spoof an answer.
 
Ell
export CXX=? idk
 
user142019
@DeadMG not really magic.
 
user142019
6:51 PM
You can do this in Bash:
 
well, I mean, well-known/common
 
user142019
$ CC=clang myexecutable arg1 arg2 arg3
 
right
 
user142019
$ export CC=clang
$ myexecutable arg1 arg2
 
user142019
Is also possibru, but that sets the variable for the entire shell session.
 
user142019
6:52 PM
CC is C compiler, CXX is C++ compiler.
 
I see
 
user142019
By default usually cc and g++ or something like that.
 
@Mysticial having claimed to be an expert in, say, templates, my [prospective] employer might get suspicious if he sees me constantly asking really trivial questions on the subject on SO. Therefore, if I'm using SO to try to act like I know more than I really do, I need to keep my questions anonymous.
 
@JerryCoffin oh ic...
 
6:56 PM
> What is name mangling in C++ and why is it used?
Does the Standard actually mandate name mangling?
 
@TonyTheLion Wasn't this posted a while back?
 
user1182183
> Husband comes back from work, goes to the bedroom and sees a naked man.
Asks: "Where is my wife?" -"Taking a shower", he replied. "I'll go into this closet and you keep your mouth shut!".
Wife comes back and yells: "Take me now, as hard as you can untill I piss myself!"
-He replied: "Open the closet and you'll shit yourself"
 
@EtiennedeMartel no
 
user142019
@Borgleader December 1, 2012, to be exact.
 
@TonyTheLion Seems like that came up a few weeks (months?) ago. Not much to say beyond: "bigoted morons will be bigoted morons". Reminds me a lot of the "FQA" -- what he's written shows enough to make it clear that there's no avoiding the fact that he has to know that at least 90% of what he's written is completely bullshit.
 
6:58 PM
oh I was wondering if he was making a point, actually?
 
He's essentially saying "C++ is bad because it's too complex".
 
with all the C++ bashing we do in here, at times, I wondered if he maybe is making a point. It seems to agree with the reasons that people (Cat, Zoidberg for example) bash CPP in here
 
While he's right about the latter, I don't think it makes C++ a bad language.
 
@EtiennedeMartel I was taking ir more as: "C++ is bad, and you should really believe me because I start by claiming to love it."
 
It's hard to learn well
 

« first day (870 days earlier)      last day (4087 days later) »