« first day (314 days earlier)      last day (4635 days later) » 

12:00 AM
I know, I'll make it movable.
 
wtf is ideone so slow
??
ok this is another interview question that really got me puzzled today
 
@cat: most probably ordinary Return Value Optimization will take care of efficiency for that. i think therefore you can save some time & work. :-)
 
I don't get how that can be possible; to call it from Bar as it is, with only that one arg? cause the declaration in Bar hides the Foo one
 
bar.Foo::set_value(123);
 
@TonyTheTiger ideone.com/GnWdJ
Force it visible.
 
12:04 AM
@RMartinhoFernandes ohhh
interesting
 
@RMartinho: You forgot "Bar as it is".
 
Oh. I only read the comment on the code :)
 
thanks :) won't forget it now
 
I'm a higher grade of genius than you
 
Than whom?
 
12:07 AM
you
 
where does the standard define dominance?
 
5
Q: Are there are robots with female characteristics in Asimov's stories?

Martinho FernandesOther than Hari Seldon's wife, are there any robots with female looks, personality, or at least name?

@DeadMG I'm not a genius.
 
then by definition I must be a higher grade of genius, which can also work for me
 
@AlfPSteinbach Someone answered :)
 
yes, i saw it earlier. great place! thanks for that question, btw.
it's regarding this question:
1
Q: Does an inherited function not count as an implementation?

David DoriaI have a function defined in a superclass, InteractorStyle. Then I have another class that requires that function to be implemented (pure virtual), PointSelector. Then a subclass of PointSelector, PointSelector2D, is instantiated. The compiler complains that I can't instantiate an abstract class ...

i'm wondering where the standard does define the virtual inheritance dominance rules?
i would plug that info into my answer
 
12:10 AM
Somewhere on clause 10?
 
yes probably, it talks a about sub-objects, but i can
not seem to get a handle on it
difficult to decompile!
i mean, the standardeese there is difficult to decompile for me
 
It works with a function!
 
i imagine Johannes will have no problem
 
So either I don't understand its documentation, or BOOST_PARAMETER_CONSTRUCTOR is borked.
 
@cat: are you using boost Parameters lib for constructor args?
 
12:16 AM
I tried.
But it borks out on argpack.
 
i remember that it was <del>borked</del> broken at the design level, but not implementation
 
Great, now that my rep is unlocked again, people stopped upvoting like mad :(
 
what's the std function to print out True or False to console from a Bool
?
 
std::boolalpha
 
I should go to sleep, instead of messing with type traits
 
12:30 AM
Messing with type traits is fun.
 
12:50 AM
I should be sleeping, instead of working
read too many books today and didn't work enough
 
Yeah, sleep.
 
when I hand in my coursework, I can sleep
then I can revise
and then in a couple weeks, maybe I can play Deus Ex
 
1:11 AM
Whose woods these are I think I know.
His house is in the village, though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there's some mistake.
The only other sound's the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
 
Woo, almost working.
 
@cat: for optional constructor arguments, I recommend using the Named Parameters Idiom, or an elaboration such as my Options classes
if that's what you're doing
 
I did factory functions, it works nicely.
 
ouch
:-)
but ok, boost Parameters can handle those
 
auto cls = create_window_class(_class_name = L"hello world", _class_style = window_class::no_style);
auto wnd = create_window(_window_class = cls, _name = L"ohai");
Doesn't look too bad.
 
1:18 AM
too many leading underscores
imo
 
Parameter does that to avoid conflicts between keywords and local names.
 
you're supposed to put the definitions in a namespace. then you don't need underscores.
anyway, due to C and Posix, best to have underscores at end, not at front
 
Details.
 
initial underscore is reserved to implementation in global namespace
 
They're actually in window_class::keywords and window::keywords.
 
1:20 AM
yes, the possible conflict comes when Someone uses unqualified names in global namespace
in your case I hitnk that would be never
 
I'll worry about fine naming details later. :P
 
1:44 AM
OMG IT WORKS.
 
congratz
 
Okay, maybe it doesn't. Anyway, some sleep.
 
 
2 hours later…
3:39 AM
@cat: ok, i looked at that code
comments:
1) it's elegant
2) in detail::make_error, should remove control characters from end of message
3) SecureZeroMemory call is unnecessary, you've already zeroed that memory
4) static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)) is pretty wrong for window background. in old times correct was reinterpret_cast<HBRUSH>(COLOR_WINDOW+1). with modern Windows, just use GetSysColorBrush( COLOR_WINDOW ).
5) return value of main incorrectly always indicates success. for the exception case you can use EXIT_FAILURE, for the WM_QUIT message case you can use wparam of WM_QUIT.
6) since I haven't used boost visitor thing i feel uncomfortable with that part of this...
:)
oh dang, didn't notice:
7) I see no PostQuitMessage or equivalent, so most probably when you close window you will get a hanging process, apparently terminated but still lurking in background
 
3:56 AM
The main/event loop is only provisional.
ZeroMemory is a force of habit. :P
Window background doesn't matter much, it's going to be used as GL/GDI viewport anyway. I'll probably remove some of those arguments completely.
 
oh hai
and I thought I was the only one that was still awake
 
Nope, insomnia attack.
 
sleepless in the s(t)ack, overflow?
 
I'm sitting staring at my UML essay and pondering if it's long enough
 
4:02 AM
but 600 easy words can't be worth 60% of a university module, surely
 
A student a NTNU (Norwegian Technical University in Trondheim) recently handed in an "home exam" answer generated by the Postmodernism Generator nonsense-generating computer program. He got a C.
 
rofl
 
that's more than a bit "wtf"
 
you can use tranlate.google.com to get a good idea of what the article says
 
4:07 AM
yeah, Chrome offers a translation automatically and I read it
 
 
2 hours later…
6:17 AM
Hey all!
 
Howdy.
 
Hey, I just wrote phases 1-3 of C++11 preprocessing! ~2.5 days and 700 lines.
 
Has the C++ preprocessor changed with C++11?
 
sbi
@AlfPSteinbach A bit early in the year for it, but nicely melancholic and poetic. What's this?
 
There main new feature in 1-3 is raw string literals.
So you can include binary data inside a source file.
Oh yeah, and there's also literal suffixes.
 
6:24 AM
Are you doing this for a purpose, or just for fun?
 
@sbi yeah, robert FROST is too early in the year :-) it was just apropos DeadMG's comment "when I hand in my coursework, I can sleep"
 
just fun. I've spent so much time reading the standard that I just had to implement something.
Also I'm trying out all the C++11 features, this is my first "real, all '11" program.
 
Are raw literals part of the preprocessing phase?
Seems odd.
 
remember, string lits have to be concatenatable by the preprocessor
so that would include raw literals
 
No, I do not think so.
 
6:26 AM
What is a raw literal?
 
Well, catenating happens after phase 3.
 
Those are AFAIK concatenated during translation/parsing.
 
A raw literal is like R"xyz(blah bl\ah)xyz"
and then the backslash appears literally in the string. Nothing is escaped.
The tricky part is that there can be trigraphs in the terminating xyz sequence.
So you have to parse the whole thing raw-style and for real at the same time.
 
Do you need to escape quotes?
 
no
 
6:29 AM
In regular literals, I did implement that. In raw literals, there's no need.
It's still pretty spaghetti in the state machines, but easy to tidy up.
Check out the "driver" at the bottom of the file. Very easy to use :) .
 
Fuck, the list of changes in C++11 is really big.
3
 
I wonder how people find me on Google+ and Skype and so on. I've asked others, they do not get requests out of the blue (especially not from US generals, attractive young ladies, and self-described hobos who have worked at Bell Labs). I just say no, but still.
 
Maybe if you out-weird them…
 
if you ever get tired of attractive young ladies
 
@StackedCrooked where you find list of changes in C++11?
 
6:40 AM
output_iterator_from_functor( ftor &&inf ) = delete; what's the = delete mean in this context?
 
sbi
@AlfPSteinbach What, is this from you?
 
@TonyTheTiger Oh, nvm. I missed that when I was deleting the dead bits.
Previously it moved that object, then I wanted to verify it didn't need to any more.
 
just never seen the = delete bit before
 
@TonyTheTiger it tells the compiler to not generate a move constructor
 
6:42 AM
Are you writing C++ parser?
 
@sbi yeah, i tried to make readers believe that you recognized the author name "frost" and not just reacted to "snow" he he
@StackedCrooked thx!
 
@CatPlusPlus Just for fun. I was surprised how much I got done in an afternoon so I kept going :)
 
sbi
@AlfPSteinbach I'm confused. I had never heard of Robert Frost before, though Wikipedia now tells me that he was a poet depicting rural scenes at times where traveling per horse might have been common. So it's by him? What's the title?
 
Stopping by Woods
 
7:19 AM
@Potatoswatter You mad.
:P
 
sbi
7:55 AM
@AlfPSteinbach Thanks! I'll try to find that.
BTW, here is something you might enjoy.
 
0
Q: hashing performance for c++ unordered_map - string vs custom keys

gewizzI'm building a hash table where the keys are int *. To compare performance, I wrote two versions. First one takes int * directly as keys with custom hash and equality functors. The other version I convert the int * to string first and then just use unordered_map<string, int>. To my surpr...

More useless benchmarks!
 
sbi
Haha: "I needed a password with eight characters so I picked Snow White and the Seven Dwarves." schneier.com/blog/archives/2011/08/…
 
anybody ever use precompiled headers in their projects?
 
Yes.
Lol that guy. Testing retrieval by writing a memory-allocating loop.
Good job, you've tested absolutely nothing!
 
sbi
8:05 AM
Wow, I'm still atop the C++ answerer list! That's ridiculous, I never compiled a single lambda statement, never even worked with a compiler that had even marginal C++11 features!
 
I mean, you'd think he'd pick up the clue after you've pointed it out twice.
 
@sbi What does "81 3" mean in front of your name in the list?
 
Oh, hey, me too.
Magic of retagging.
81 upboats on 3 posts.
 
sbi
@foobar If you hover you mouse over them, the hints will explain it.
@CatPlusPlus No, you are not atop of the list, too. I'm up there all alone. :)
 
@sbi But I'm on the list!
 
sbi
8:13 AM
@CatPlusPlus Yeah, @RMartinho and I did that. :)
 
8:30 AM
Could you comment on this answer? I believe it is wrong.
 
it's not wrong at all
 
Maybe irrelevant, but definitely not wrong.
 
the && operator short-circuits, so you'd do best prioritizing your least expensive checks
if it's not micro-optimizing anyway
 
The answer is overly ambiguous and the commentary is misleading, but I wouldn't call it wrong.
 
I say that o.a() && (o.b() && o.c()) is equivalent to (o.a() && o.b()) && o.c(). Am I wrong or not?
 
8:33 AM
Now that is wrong.
&& works just like if.
 
those aren't the only two alternatives given in the opening post
 
0
Q: Is COBOL language hard to learn?

ArtiI want to join a Mainframe course and in this field COBOL is used.Is COBOL language hard to learn?

Madness.
 
Hah. What country is he in I wonder?
 
@Potatoswatter What exactly are you saying? Are the two not equivalent?
 
8:35 AM
Oh wait, that's not a country.
 
2
Q: How to use stdafx.h properly?

MehrdadWhat is the proper way to use stdafx.h, in terms of separating dependencies? If I put everything in there, then my compiles are blazing fast, and all I need to say in any file is #include "stdafx.h" with the caveats that: I no longer know which files depend on which headers. It reduces modu...

Am I incomprehensible there?
 
@RMartinhoFernandes Disco country?
@foobar No, the first example says to call a, then b if a returns true then c if b returns true.
 
@Potatoswatter Here is the proof that o.a() && (o.b() && o.c()) is equivalent to (o.a() && o.b()) && o.c().
 
@Potatoswatter And the second does the same thing.
 
Hmmm, unintuitive.
 
8:37 AM
&& is associative.
 
@Potatoswatter In both examples, a() is called first.
 
ok, playing around and learning to use type traits, but this isn't working as I expected for the std::string* can someone help?
 
I never thought whether associativity fixed the order of evaluation.
 
It doesn't. It's &&'s short-circuitry that fixes the order.
 
It's clear that a is called first, but I thought maybe c would happen next or something.
Learned something today. Not that I use && for long chains of flow control…
 
8:40 AM
@TonyTheTiger is_string is false for a pointer.
So it never gets to algorithm_selector<true>.
 
@CatPlusPlus so how would I make it work for a string pointer so that it ends up in algorithm_selector<true> ?
 
You need to use either std::remove_pointer or more explicit specializations.
std::remove_pointer might need to be called more than once to remove all the splats (consider std::string***).
 
explicit specializations of is_string ?
 
@RMartinhoFernandes std::decay?
 
Hmm. What's that.
 
8:43 AM
pretty sure that it's all pointer, all cv, and all references removed
 
No. std::decay<std::string*>::type is std::string*.
 
ok, maybe it's just all cv & all ref
 
Yes, cv, refs, and makes function pointers from function refs.
And array-to-pointer decay.
 
I feel like I'm not talking English today. Is it that bad? Can you people understand me?
 
so I should amend this specialization to call std::remove_pointer?
template<>
struct is_string<std::string>
{
	static const bool value = true;
};
just not sure where in this I should call that?
@CatPlusPlus you're speaking English
maybe you're not thinking in English, but that's hard for us to determine
 
8:46 AM
I usually think in English, which is weird sometimes.
 
I seem to be capable of parsing your output
 
algorithm_selector< is_string<remove_stuff<U>>::value >::implementation ( object )
What about on here? stackoverflow.com/questions/7201904/… I'm repeating myself, and I don't know if he doesn't read what I write, or I'm writing incomprehensible stuff.
 
template <typename T>
struct is_string
{
    static const bool value = std::is_same<std::string, remove_stuff<T>>;
};
Or this.
 
hmm removing that, will not let my is_pointer detect the fact there was a pointer inside the algorithm_selector<true> thing?
 
8:51 AM
Morning
 
Hello.
Forgot a ::value above. And a ::type and a typename.
 
in my algorithm_selector<true> I want to be able to detect wether it was a pointer or not, so removing it before hand will defeat my objective here
so, I can detect wether it was a string, but can I somehow also allow for string* to be passed through, all the while keeping that fact it is a pointer
not sure if I'm making sense
 
@CatPlusPlus I do that sometimes too, this is scary.
 
@TonyTheTiger But your detecting that through the function argument. That one won't change.
 
Oh, right, typename.
 
8:55 AM
Woo, c++ is now my second highest scoring tag.
R. Martinho Fernandes, Braga, Portugal
18.4k 6 37 76
Damn, chat hasn't updated yet.
Stupid caches.
 
Oh noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.
 
Burn.
 
Well, you've got .
 
8:57 AM
:(
Hmm, seems like this only shows popular tags or something.
 
How are those tags even determined.
I have more boats on algorithm than php.
 
I have a much higher score on than .
 
Hell, I've got more votes on than .
 
And . Why isn't there. :(
 
8:59 AM
I think I've missed something
template<typename T>
struct is_string
{
	static const bool value = false;
};

template<>
struct is_string<std::string>
{
	static const bool value = std::is_same<std::string, std::remove_pointer<std::string> >;
};
 

« first day (314 days earlier)      last day (4635 days later) »