« first day (326 days earlier)      last day (4621 days later) » 

7:00 PM
@LucDanton I wouldn't yet know how to do that template wizardry
so whoever want's some rep... lol
 
> If you need to use methods that are not common between the two containers, you can create two derived wrapper classes with a pure virtual base class that defines a common interface for operations you would like to-do
Who let Java programmers into a C++ thread?!
 
@CatPlusPlus I was wondering about that... I was gonna comment, but wasn't sure what he meant
 
I was going to explain it but it's too stupid.
 
@LucDanton in what way is it stupid?
out of curiosity, I'd like to know how it would be done, if anyone can be bothered to show me
 
It moves the two implementations into a hierarchy -- but then client code has to pass the correct implementation to the function accept the interface.
@TonyTheTiger Put your template into a class as a functor and visit a Boost.Variant.
Or don't use a template at all if you want to use push_back.
 
7:06 PM
should I export a function instead of a constant here?
//------------------------------------------------- Interface:

namespace dll {
    using std::wstring;

    extern HINSTANCE const&   moduleHandle;
    wstring filepath();
}
 
That's the 'get it done quickly' way.
 
@LucDanton I don't see how the variant enters in here?
 
Funny how you sometimes get a downvote for a two year old unpopular post.
 
boost::variant<std::vector<T>, std::whatever_was_the_other_container<T>>
 
hash_set
 
7:07 PM
@TonyTheTiger The variant will get initialized with whichever container the client wants to use and the visitation mechanism will (dynamically) dispatch accordingly.
 
@RMartinhoFernandes I can't help but find that a weird concept, putting containers in a variant
@StackedCrooked which post was that?
 
Well, that's generic code for you. There's not telling what T... is in boost::variant<T...>
 
yea I guess
 
-1
Q: Launching applications silently?

StackedCrookedMy C++ application calls VLC as a subprocess. Is there a way to avoid having the GUI pop-up? I am looking for a Mac and a Windows solution. Hackish workarounds are welcome too. PS: I know there is such a thing as cvlc (command-line version of VLC), but I haven't found any builds for it online. Y...

Perhaps not the best question.
 
there's really no way in templates to specify that a T can only be of a certain type, is there?
 
7:09 PM
But I was new to all of this back then.
 
@TonyTheTiger static_assert? What do you have in mind?
 
You can static assert.
Or use BCCL for more fancy stuff.
 
in C# for example, you can say it has to be a class or whatever or it has to support a certain interface
 
C++ generic programming is coded against expressions, not interfaces.
To do that, ugly TMP.
 
hmmm ok
 
7:13 PM
Now that you mention it, my code doesn't have that many static_assert.
Well, that was food for thought. Thanks!
 
lol
I merely asked a few questions...
 
C++ class take two.
 
Mmmh, that probably means writing an Invokable trait to supersede my current concept.
 
Fuck, I can't wait, I'm doing that right now.
 
7:16 PM
Invokable trait?
 
`static_assert( is_invokable<decltype([] { return 42; }), int()>::value, "Yep" );
 
As an example from the specs of std::bind
> [...] INVOKE (fd, w1, w2, ..., wN) (20.8.2) shall be a valid expression for some values w1, w2, ..., wN, where N == sizeof...(bound_args).
 
I love how you guys get so creative with the language and template wizardry, I really need to catch up on the template stuff
 
Well
Do you know the problem with declaring something like void pass_callback(std::function<void()> callback);?
 
7:21 PM
@LucDanton guessing here... that you're passing void?
to the std::function
 
No that's a signature in there
The problem appears when adding an overload such as void pass_callback(std::function<void(int)> callback);
 
the problem being?
 
Then pass_callback([](int) {}); becomes ambiguous when it shouldn't.
 
how so?
 
Because the functor that is passed can only be reasonably used by an std::function<void(int)>, not an std::function<void()>. Sadly, the Standard didn't put a requirement here.
i.e. callback() is a compile error for std::function<void()>
 
7:24 PM
so it should have an int arg?
 
Well
The std::function<void(int)> overload should be called
I think I'm explaining this backwards; how familiar are you with std::function?
 
you could overload using enable_if on std::function<T>
 
@LucDanton I've only used it once or twice
 
Yeah, but you need a trait for that. Which I'm writing!
@TonyTheTiger Right.
So given std::function<void()> f;
You can do f = [](int) {};
 
oh...
 
7:27 PM
but then when you do f(); it's a compile error because the functor obviously excepts an int.
 
what creates the need for an int?
 
So the constructors (and assignment operators) of std::function are a bit too eager in that they allow anything (or almost anything, not sure).
 
it is possible to use SFINAE to reject arguments that don't make sense
 
someone just said that and that is what @LucDanton is writing
 
@TonyTheTiger I just explained how construction/assignment of std::function is flawed; the need for int is the first example where for instance you want to provide two different overloads for different signatures. That's why it was backwards.
 
7:30 PM
oh I see
 
sbi
@TonyTheTiger There was a concept called "concepts", which meant to allow you to do just that, but it was removed from the standard last year.
 
Imagine that we're setting up a list of callbacks that client code can subscribe to. Some of the code might want to have a relevant int parameter (the time, or whatever), but if you want to make it optional then that's an attempt at it.
 
sbi
No, it was removed 2009, I think.
 
@sbi ohh that's what they were for, I kept hearing about them, never really wondered what they were for
 
template <template <typename T> class z>
class a {};

template <typename T>
class b
{
public:
a<b> c; // what actually happens at this line?
};
if we instantiate b<int> , then what happens to line a<b> c;
 
7:33 PM
then I guess you get a<b<int> > c
 
@TonyTheTiger : so T template template's type parameter instantiates to int , right?
 
sbi
@MrAnubis Nothing happens to the line, it doesn't change at all, but the compiler instantiates a a<b<int> > from it.
 
but I"m not sure that creating a template which takes as arg a template, inside the template that is given as said arg, is a valid construct. But I may be wrong
 
sbi
@MrAnubis No, the template template parameter (z) becomes b.
 
@MrAnubis What @sbi said
 
7:35 PM
@sbi (I feel the need to add: 'unless a accepts a template template parameter'.)
@sbi Isn't that fixed?
 
sbi
Note that b is not a type, but a template. You cannot use it where a type is expected, which is why you cannot use it in place of a type template parameter.
 
right.
 
sbi
@LucDanton Huh? It accepts nothing else.
 
@LucDanton I have a simple function type traits implementation: decl impl
 
this whole concept is class name injection?
 
sbi
7:37 PM
@LucDanton Yeah, I got this wrong. Sorry, @MrAnubis, I fixed it now. The template template parameter becomes... Wait.
 
@sbi complex language
 
sbi
(I really shouldn't try to do this while actually doing something else.)
Does that even compile?
 
yes
 
Ok, here it is. a<b> will instantiate an empty class.
a<b<int>> is not valid, because b<int> is not a template.
 
sbi
@MrAnubis No. It doesn't. ideone.com/GvfTK
 
7:39 PM
@Kometes That's not really what I'm doing though.
 
oh ok
 
sbi
@RMartinhoFernandes Yeah, but inside b, b is synonym to b<T>, no?
 
@sbi Oh, nasty.
 
i think we can safely say that for a compiler that compiles it cleanly, a<b> means a<b<T>>.
 
@sbi Switch to C++11 and it's accepted. Resolved.
 
sbi
7:40 PM
@RMartinhoFernandes Actually, mostly that's quite convenient.
 
@sbi it works , i tested it
 
sbi
@LucDanton Huh? Did C++11 change those rules? How exactly?
 
yes i am compiling it in c++11
 
In a template template parameter situation, the injected class name is a template. Otherwise, it's a type.
 
7:41 PM
IOW, it does what you want.
 
sbi
@RMartinhoFernandes Yeah, that works. Mhmm.
 
Perhaps there are situation other than template template parameters where it does, but I can't recall.
 
Factoid: @MrAnubis' code compiles fine with Comeau Online. Means it's OK.
 
sbi
@LucDanton Indeed?! Wow, yet another special rule to remember. As if C++ didn't have a four-digit one already...
 
@sbi : it works since class name injection works differently now in c++11 i think
 
7:43 PM
@sbi It's quite inconsequential but unambiguously solvable, so it didn't make waves I suppose.
 
sbi
@AlfPSteinbach I have once found a bug in Comeau. :) (But I found dozens in CW, VC and GCC, so that's pretty good.)
@MrAnubis Yeah, obviously.
 
@sbi Our records match except for CW, which I think means CodeWorrier (?), which I haven't used since I don't worry about code.
 
How do you guys remember all the special rules in regards to templates, there's so many, and since I've been reading up on templates, I'd be interested how you cope with it?
 
sbi
@LucDanton They considered templates simple and unambiguous extensions, too. Until Mr. Unruh showed them what a monster they had created.
 
@AlfPSteinbach CodeWorrier, lol
@TonyTheTiger I have a good memory, remember? ;)
 
7:45 PM
I second Tony's question... especially the part where I have to add 'typename' when it does not compile and apparently should...
 
sbi
@TonyTheTiger I've been first using templates in the mi-90ies. That's a lot of time to remember stuff.
 
@RMartinhoFernandes you, but you're an exception to the rule
 
sbi
@Samaursa I think we have an FAQ entry for that. If not, we should.
 
32
Q: Where and why do I have to put "template" and "typename" on dependent names?

MSaltersIn templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway? I have the following code: template <typename T, typename Tail> // Tail will be a UnionNode too. struct UnionNode : public Tail { // ... template<typen...

 
@sbi oh I see, so I guess by using and abusing, I'll eventually get to know
 
7:46 PM
aha! thanks!
 
@sbi Was that a literal, appropriately-named Mr. Unruh or an idiom?
 
@Samaursa that's just dependent and non dependent names, that's only a small fraction of the rules I"m talking about
 
@TonyTheTiger Using them and writing them enough that once I've tripped enough over the same traps, I roughly know how it works.
 
The only Unruh I know is from physics.
 
there's loads more, like the one's about nontype paramaters not being able to be double or float, for example
@LucDanton thanks for the tip :)
all this pedantry.... damn damn
you'd start getting pedantic after dealing with templates
long enough
 
7:48 PM
I think sbi just got dadnapped.
 
sbi
@LucDanton It's Erwin Unruh. A likable guy, I once had a beer with him, and there I asked him and he told me the story of erwin-unruh.de/primorig.html.
 
@TonyTheTiger I know what you mean... although I find that once I know 'why' it is the way it is, I remember it
 
@Samaursa I do, mostly, but I still forget bits, or in lots of cases, I just didn't understand it correctly
 
Oh that Unruh.
 
sbi
@RMartinhoFernandes The German word "Unruhe" means something like "disquiet". So his name somewhat fits the storm that he lead off the leash.
 
7:50 PM
> | Type enum{}´ can´t be converted to txpe D<19>´ ("primes.cpp",L2/C25).
"txpe"
 
@sbi 'Unrest'?
 
ruhig sein, is being quiet, so not sure unruhig is unrest perse
 
sbi
@RMartinhoFernandes The one I linked to is the original, which doesn't compile anymore, because it isn't valid C++. At the top of that page is a link to a "modernized" version.
@LucDanton Yeah, that would fit, too, if it is an English word.
 
@sbi Yeah, I just checked that on the Vandevoorde-Josuttis book.
 
@sbi It is, also current connotations are more like 'riot'.
 
"There was some unrest during the football match." not always a riot though.
 
Per this unruhig is restless, so I guess @LucDanton was correct
I suck
 
sbi
@LucDanton Yeah, indeed. (What happened in the Arabian world made the news often use that word this year.)
 
@TonyTheTiger Right. So many examples come to my mind when I had trouble remembering some things simply because I did not know the underlying reasons/inner-workings. For example, the way static variables are defined... always had to look it up, because I didn't understand why it was done the way it is. Now that I do, it is not so difficult.
 
sbi
7:55 PM
> The title of the episode, "Unruhe", is the German word for "unrest" or "anxiety". When Scully talks in German to Schnauz, she says "Ich habe keine Unruhe" (literally "I do not have anxiety").
"Unruhe" is a 1996 episode of The X-Files television series. It was the fourth episode broadcast in the show's fourth season, and the first episode to air on Sunday night when the show was moved from Fridays to Sundays. "Unruhe" features a man who kidnaps women and lobotomizes them. The agents' only clues to catching him are distorted photos of the victims taken just before their kidnapping. Plot In Traverse City, Michigan, a young woman, Mary Lefante, goes to a local pharmacy to get her passport photo taken. While waiting for it to develop, she returns to her car and finds that her b...
 
@sbi I watched an entire movie in German once, without subtitles, and I understood quite a bit of it, I thought :P
 
"I thought" lol
 
@Samaursa True that, I completely agree with your reasoning there, I have the same thing
@sbi huh?
 
sbi
@Samaursa Don't worry. I still look up the syntax of template template parameters...
@TonyTheTiger I can ask it to define a German word, and it even leads me to translations.
 
7:58 PM
0
Q: Wierd behaviour with name lookups and namespaces

ronagI just found a behavior I find rather weird in regards to namespace look-ups. namespace r { namespace a { struct a_object{}; }} namespace r { namespace b { struct b_object { a::a_object my_a; // a::a_object not found, must be r::a::a_object } }} Even though b_object is in the r names...

 
Writing "wierd" is weird.
 
@sbi gotta love Google!
@RMartinhoFernandes lol
@RMartinhoFernandes FTFY
 
@sbi :) ... you know, I pulled my hair out once because this would not compile: std::vector<std::vector<int>>
 
@TonyTheTiger Sorry, what did you fix?
 
@Samaursa ugh, that's a tricky one, I almost died on that too
 
7:59 PM
Ah, the title.
 
@RMartinhoFernandes the spelling error in the title, we're pedants for a reason :P
actually, I have a really big thing on people misspelling things when they post on SO, it'looks so retarded to have a question full of spelling errors
MUST FIX ALL THE SPELLING ERRORS
 
Können Sie mir getellen warum die Aufgabens im schule gesucks?
 
@TonyTheTiger I make them even after I have read the question a few times... but at least I can edit it... I once sent an email to the dean with the words "Tank you" at the end.
 
You're talking to the guy that always starts his sentences with capitals and always ends them with a full stop or alternative punctuation.
 
A comb is a device that brings your hair into alignment.
 
8:02 PM
(Well not always always, but close)
 
I do that when I'm texting too. People must think I'm weird.
 
Are there any game developers here?
 
@ManofOneWay weil es die Schule ist, es geht drum aufgaben zu machen, um den am endes des Jahr einen Diplom zu bekommen :P
 
Oh, gibberish.
 
Ja, das ist wohl wahr
 
8:04 PM
yeah i'm a gamedev
 
@ManofOneWay hast du in die Schule den Deutsch gelernt?
 
Ich wolle eine Diplomen gern gehaben
 
@Kometes Do you work on small games or larger scaled games?
 
small
 
@Kometes How small is small?
 
8:06 PM
@ManofOneWay ja, ich heatte gerne einen Diplomen gehabt, aber leider hab ich es doch nicht getan
lol, my German must suck :P
 
like mobile
 
@Kometes Ah, I see. I had some questions but I think they don't apply to you.
 
@TonyTheTiger Ja, aber es war viele jahren seitdem
 
In general though, instead of making a SO question out of it, does a compiler do 'any' optimizations in debug builds? (this is for anybody who can answer btw)
 
Deutschland ist das Land der Helden und Ehre
 
8:07 PM
@ManofOneWay was war viele Jahren seitdem?
 
@TonyTheTiger Deutsch gelehren
 
@ManofOneWay ah, nun verstehe ich.
 
@TonyTheTiger Gut
@TonyTheTiger Deutsch sind ganz leicht
@TonyTheTiger Ich denke wie gibt
 
@ManofOneWay Ja, die worter sind nicht so schwer, aber die grammatik finde ich schwer.
@ManofOneWay huh?
 
@Samaursa yes
 
8:11 PM
@TonyTheTiger Ja, aber die grammatik sind discpliniert. Im Vergleich zu weiblichen Sprache wie Französisch
 
A compiler always optimises your code in some way. A debug build is optimized for debugging, but that doesn't mean it will output dumb code.
 
@kbok ok, that I understand. I ask this because most of the game productions I have been part of so far are unable to run in debug configuration.
@kbok The ones that did, there was a lot of emphasis on optimizations that are generally frowned upon on SO.
 
@ManofOneWay was meinst du wenn du "weiblichen Sprache" sagst ?
 
sbi
@Samaursa I think I never did this one. But I do remember spending hours on funny and inexplicable error messages in some system headers, that turned out to be a semicolon missing in one of my headers - several times... Nowadays, when I see these kind of errors, I have that fixed within a minute, but this must have cost me several days of my life. :(
 
@Samaursa Do you have some examples ?
 
8:15 PM
@TonyTheTiger Französish sind nicht ein sprachen fur der richtich Man.
 
sbi
@TonyTheTiger My browser comes with a spill chucker. :D
 
@sbi well, good for you :P
 
No French bashing please, I'm still there.
 
@sbi Wollen Sie die Deutsche konversationen beitreten?
 
@ManofOneWay ah, du denkst das Französisch nuer fuer Frauen ist oder was?
 
sbi
8:17 PM
Wow, I turn my back for not even 5mins, and those bloody furriners start to speak German!
2
 
@sbi lol :P
 
lol did some of you guys upvote that question I posted recently (about launching vlc silently) :D
 
@StackedCrooked yea, I gave upboats, thought the downvote was unjustified :P
 
@kbok Off the top of my head... pre decrement, reference variable for a line of code that is dereferencing more than once (e.g. something->somethingelse.somethingelse), unrolling loops via macros (this is a big one)
 
I was in Berlin four years ago for the Love Parade. The last one I think.
@TonyTheTiger great, thanks :D
 
8:18 PM
@kbok not calling too many functions (big functions are ok)
 
@StackedCrooked Where is the question? Let me upvote
 
@kbok returning almost nothing but basic data types... everything else goes into function arguments as 'out'
 
sbi
@TonyTheTiger You know, here in Germany, "Französisch" also means "oral sex".
 
UPVOTE ALL THE QUESTIONS
@sbi oh now you're turning it sexual eh?
 
@sbi What.
 
8:19 PM
I hadn't mentioned sex all day
 
@ManofOneWay it was actually not a very good question (link).
 
sbi
@TonyTheTiger Well, you brought it up.
 
I think, anyways, @RMartinhoFernandes might prove me wrong there
 
@StackedCrooked great question! +1
 
@sbi no, you interpreted my sentence in a way in which I didn't intend it for it to be interpreted :P
 
8:20 PM
does anybody here us Xcode for c++ development?
 
sbi
@kbok Ha, I bet nobody told you that, eh? :)
 
@ManofOneWay you are too kind :)
 
@Samaursa These all sound like optimization that could easily be done by your compiler. I understand why they're frowned upon.
 
@sbi I wonder how that definition came to be? Do you know the history?
 
@kbok even in debug?
 
8:21 PM
The German word for "French" is the same as the word for "oral sex"?
 
sbi
@TonyTheTiger Of course you now deny any responsibility. I'm not impressed, though, I was expecting that.
 
@StackedCrooked Your answer was great as well! +1
 
sbi
@TonyTheTiger No idea. Really.
 
@sbi oh, I should have found something better to say eh
 
8:21 PM
@kbok And here's another interesting one... in general, I have seen very little to no use of the standard library... boost is out of the question, have yet to see an engine I worked on that used boost.
 
@Samaursa Not all of them. For example, some function calls might be inlined if the compiler thinks it's a good idea (and you can generally trust him.) In debug mode, he won't do that, because that would prevent you from analyzing the call stack.
 
I just hope it won't go as far as you guys starting to interpret my C++ questions sexually, cause then I'm gonna get worried :P
 
@ManofOneWay I posted that question back when I was working for a company called Streamovations. Worst. Job. Ever. Only lasted five months.
 
@RMartinhoFernandes yes
 
sbi
@TonyTheTiger You know, up to now I hadn't even thought of it. :)
 
8:23 PM
@kbob Right. So unless I spent time looking at the disassembly, I can't really be sure what optimizations, if any, the compiler is doing in debug. For all I know, it is not doing any.
 
@Samaursa boost and stdlib may be too general purpose for that matter, so I understand
 
@sbi oh noes, now I gave someone the wrong ideas... and who's to blame, ME goddamnit
 
template<typename U>
static
yes&
test(U&&, typename void_<decltype( consume(std::declval<U&>()(std::forward<Args>()...)) )>::type* = 0);
That's not really nice.
 
@Samaursa Generally speaking, the compiler won't do anything that could hinder the debugging of the app. For the rest, he does as he pleases.
 
@StackedCrooked what was bad about that job?
if I may ask
 
8:24 PM
The manager.
 
oh, aren't they always bad though, they're managers, what else do you expect?
 
He sold products that didn't exist and then put pressure on the employees to make his fantasy become real.
 
@kbok Alright. In other words, he may not optimize at all.
 
@Samaursa Yes.
 
@StackedCrooked sounds like the company I used to work at
lulz
 
8:26 PM
Managers aren't always that bad. In my current company the upper layer staff is quite competent (CEO is also a university professor).
 
oh cool
 
@Samaursa For how long have you been in the industry ?
 
@kbok Not too long. About 2.5 years.
 
10
Q: Why does Windows64 use a different calling convention from all other OSes on x86-64?

SomejanAMD has an ABI specification that describes the calling convention to use on x86-64. All OSes follow it, except for Windows which has it's own x86-64 calling convention. Why? Does anyone know the technical, historical, or political reasons for this difference, or is it purely a matter of NIHsynd...

interesting
 
Proof for the "Franzosisch" thing : de.wikipedia.org/wiki/Franz%C3%B6sisch
 
8:31 PM
J't'emmerde
that's the only thing I know in French
it's also a song by MC Jean Gab'1
 
> Oralverkehr, umgangssprachliche Bezeichnung einer sexuellen Praktik
lol, like 69'er
 
I passed my final German exam because I remembered the contents of a text we've seen during class. Not because of my mastery of the language. Something must be wrong with this kind of education.
 
yes, that sounds wrong
 
@StackedCrooked Nowadays I guess it would be best to learn chinese. As they will soon take over the world.
 
And the (female) teacher spent most of the class time gossiping. Ok, in German.
@ManofOneWay currently learning Japanese actually.
 
8:35 PM
@StackedCrooked Not good. China don't like Japan. So you are still their enemy
 
@TonyTheTiger oh, in the comments there, a four letter word.
 
ja, aber Deutsch ist auch eine nette sprache zum lernen :P
 
@StackedCrooked So now you know that "dattebayo" does not mean anything at all :)
 
@AlfPSteinbach upboats for four letter words :P
 
@kbok doesn't ring a bell..
 
8:36 PM
naruto
 
"Datte" is an expression I commonly hear in anime.
@Kometes yeah, just googled it and urbandictionary came as a first hit.
 
"dayo" is super common, it's a (male) suffix to emphasize, and "te" and "ba" are, AFAIK, a childish emphase suffix and an old one used in rural zones.
 
Why the fuck do I end up on the voicemail of someone when calling my own voicemail.
I mean, not their messages, but it's like calling them.
 
@kbok I thought "dayo" is simply "da" + "yo". "da" being the informal variant of "desu", and "yo" indicating emphasis.
 
Anyone here want to tell me what the carat ^ is in C++ ?
 
8:42 PM
binary XOR
 
^ is used in C++/CLI
 
@StackedCrooked safe pointer types
 
yeah
Never used C++/CLI though.
Would like to give it a try, but the opportunity hasn't arisen yet.
 
@StackedCrooked It is. I just wanted to make it short :)
 
@StackedCrooked yep
 
8:45 PM
> ?SI and ?DI are string instruction source / destination operands, and as cHao mentioned, their use as argument registers means that with the AMD64 UN*X calling conventions, the simplest possible strcpy() function, for example, only consists of the two CPU instructions repz movsb; ret because the source/target addresses have been put into the correct registers by the caller.
This is awesome.
 
@kbok woah, so that's a fairly cheap operation then on that architecture
cool
 
jeez, is anything fixed around here?
 
@Kometes You know some Japanese?
 
been broke for year and half
 
@CodeMonkey if meta police don't consider it necessary for fixing, they won't fix it
they only add random restrictions to everything, so they can piss people off
 
8:59 PM
they are probably mad because I called SE a business
 

« first day (326 days earlier)      last day (4621 days later) »