« first day (1026 days earlier)      last day (3928 days later) » 

11:00 AM
@R.MartinhoFernandes yea, sure.
 
no, stars don't hold addresses. They shine in the sky at night.
 
@R.MartinhoFernandes What, you don't do that on purpose?
 
Erm.
You don't.
 
what the fuck is going on
 
OK guys, srsly, that's enough.
2
 
11:04 AM
help vampires
 
I want to use std::is_base_of
with an object
 
Er. Sorry... It's been a long day. I'm not usually this bad...
 
@khajvah that's cool, I guess. Go use it.
 
@khajvah That sounds wrong.
 
so i need the type of obect to use that
 
11:05 AM
The "you don't need it" kind of wrong.
 
why?
 
Why do you think you need it?
 
ok, I have a base class and derived class
 
because you haven't told us what actual problem you're trying to solve
 
the object is either derived from base or derived from derived
 
11:06 AM
so it's always a "child" of base.
 
2
Q: Check if class is derived from a specific class (compile, runtime both answers available)

khajvahIt is easier to explain on an example so, class base { //.... } class derived1 : public base { //... } In my library, there is a pointer of base class. The user of the library have to make classes derived from either base or derived1 and assign pointer to that class. How can I check what cl...

You asked that question and even accepted the answer
 
that's my question
 
WTF are you doing here?
 
yes
kind of
but the problem is not the same
 
Not "kind of", you accepted the answer
 
11:07 AM
@khajvah so what the problem is again?
 
ok
std::is_bas_of helps to find out if a class is derived from base
but
 
also there is plenty of info in the various answers and links to other questions in comments
 
@khajvah you don't need it
 
i have to give the type to base_of
 
@khajvah You don't need it.
@khajvah You didn't even read/try/whatever the accepted answer (it won't ever compile!)
 
11:08 AM
i actually did try
not with object but with type
before accepting
 
dude, can you simply state what you are trying to do?
 
I have an object
actually a pointer
 
inb4 bin
 
which is pointed to either base of derived class
 
and stop spamming enter.
 
11:10 AM
how which of those it is pointed to
 
no, that's not the problem you are having.
that's the problem you are creating yourself
 
whatever
I will try to do smth, i just cannot explain
sorry for that
 
We cannot help solve a problem we don't know.
I thought that would be obvious.
 
Apparently people think we really own crystal balls.
 
Stop it
 
11:12 AM
stop what?
 
:D
talking like I am stupid
Maybe it is because I am not native english speaker
 
Nobody said you're stupid. You are unable to explain your problem, however.
 
maybe
 
@khajvah Neither of us is.
 
I'm sure you don't need is_base_of because you said you have an object.
Whatever problem you are solving, if it starts with an object, is_base_of is not the solution.
@khajvah What type does that pointer have?
 
11:17 AM
Ohai robot
Maybe you missed #include <array> and #include <iterator>? — R. Martinho Fernandes 2 hours ago
^ on gcc <array> appeared to be enough :<
I wasn't even aware that `begin`/`end` was in <iterator> (I'd half have expected this to be in `<utility>` too
 
huh
this is the first time I slapped a bounty on a question but didn't get a bunch of answers or comments on it overnight
 
@R.MartinhoFernandes another poor sod
 
@R.MartinhoFernandes wow. One.
 
11:21 AM
just look at the dates and it tells it's own story
 
@BartekBanachewicz Out of two.
 
@R.MartinhoFernandes Oh okay I've noticed the user. Apparently there are some modifications to chat :F
Last one was Aug 2 this year
 
@BartekBanachewicz Yeah, but the one before that was February, and the one before that was November last year.
 
@DeadMG IKR
 
11:44 AM
meta is an oxymoron - it is the most troll infested place where you are told you should not be trolling anywhere else on SE
 
@Telkitty猫咪咪 you are the last person that should speak in that matter
 
I have never been banned from meta chats
 
That's completely irrelevant
 
some moderators are trolls themselves
 
11:48 AM
@Telkitty猫咪咪 Some of them are just clueless
presumably well-meaning, but clueless
 
Some, not many though. More trolls in the mod list than clueless ones
But I agreed, there are clueless, well meaning mods around
 
@Xeo Oi.
 
oo the subtle subst pun, I wonder if the dogs will hear it — sehe Aug 3 at 21:08
I don't see a pun
@CatPlusPlus I think that will haunt you for a few more years :P
 
@ThePhD What page?
 
12:07 PM
 
// I guess this is UB?
template<typename T>
boost::optional<T> get_first(const std::vector<T>& vec)
{
    return boost::make_optional(!vec.empty(), vec.front());
}
Due to undefined order of evaluation of function arguments..
 
Xeo
Erm, that is UB in any case?
Since vec.front() is always evaluated.
 
It's UB due to function arguments being always all evaluated.
 
12:12 PM
@Xeo lol
Silly me.
 
@TonyTheLion ?
 
Look again
 
What?
 
@StackedCrooked return !vec.empty() ? vec.front() : none; is still a one-liner and I think it's ok
 
12:13 PM
@TonyTheLion I did and I still don't see it.
 
@TonyTheLion Still don't get it.
 
He went down in history.
 
@TonyTheLion That is a very insidious pun.
 
Indeed :)
 
@BartekBanachewicz yep
 
12:13 PM
@TonyTheLion A reindeer?
 
@R.MartinhoFernandes Look at his history grade
 
rain dear
 
What's the... I still don't get it.
 
Xeo
Rudolf the Red-nosed Reindeer.
Went down in history :s
 
@R.MartinhoFernandes His grade went down in history.
 
Xeo
12:14 PM
It's a baaaaad pun.
 
That's it?
That's all of it?
 
apparently.
 
Yes
oh gawd, I don't know how to make you guys laugh anymore. I think it used to be easier. :/
 
it really, really doesn't work for virtually anywhere except the US, I believe.
 
I might have found it funny if the thing holding the card was someone that went down in history.
 
12:16 PM
 
yeah, the whole reindeer thing
 
Time for Laced/Unlaced
 
it's like impossible to notice that they're supposed to be reindeer
 
12:17 PM
I don't think this Rudolph thing is widely popular outside the US.
 
I don't even remember that
 
I have just answered a Q on "what is a raw pointer" because I couldn't find a dupe :V
 
Ha, these guys are always on the same place with this sign avanthard.files.wordpress.com/2013/07/…
 
12:27 PM
> error: default argument specified for lambda parameter
Really?
 
Xeo
lol
 
> Default arguments (8.3.6) shall not be specified in the parameter-declaration-clause of a lambda-declarator.
Fuck you C++.
10
 
Starbait taken.
 
Next I tried foo({}) but the argument is deduced :(
 
virtual ~A() = 0;
what?
 
Xeo
12:30 PM
A pure-virtual destructor
 
is that a thing?
 
Xeo
yes
 
Every thing is a thing. Not everything is a thing.
 
Xeo
You still have to define it, outside of class though.
 
12:31 PM
@Xeo Which makes it sorta pointless.
 
Xeo
It makes the class abstract!
 
@R.MartinhoFernandes Hahahaha
 
@TonyTheLion :)
 
@Xeo And how is that useful without pure virtual functions?
 
Xeo
vOv
 
12:34 PM
@Xeo wait, you have to define it in the class that declares it or only in derived ones?
 
Xeo
struct A{ virtual ~A() = 0; };
A::~A(){}
 
ah I see
that's why my answer got downvoted
damnit, I don't know C++ enough
 
That's normal.
 
probably
 
@LucDanton How would that work? How could the compiler supply the default value, e.g. when inlining, across a function pointer (taken from a stateless lambda) or, god forbid, a std::function<> wrapping a lambda?
With c++14 poly lambdas, there might be a loop hole with implicitly defined overloads without the default params, but somehow I feel this would create awkward surprises with generic overloading
 
12:38 PM
@sehe How does everything you said work for functions?
 
@LucDanton Am I on your plonk list?
 
@sehe Pretty easily, actually.
 
@LucDanton I think the compiler gets the default value from the declaration (not the definition) and supplies it at the call site. {This explains the usual conundrum with virtual methods and default parameters}
 
Xeo
@sehe A function pointer can't have / use default parameters.
 
Tony must feel lonely now scott & phD don't come here anymore
 
12:40 PM
@Xeo Precisely. So how would your lambda still be assignable to a std::function?
 
Xeo
Erm
 
You have wrong assumptions.
 
Xeo
The same way normal functions with default arguments are?
 
Mmm. Ah. Overloads. Erm.
 
@Telkitty猫咪咪 PhD was here earlier today, and ScottW was here yesterday.
 
12:40 PM
@Xeo Yeah. I'm beginning to see my hangup here
 
stop talking rubbish
 
Xeo
void f(int a = 0){}
std::function<void(int)> x = f;
 
@TonyTheLion Do you expect that to happen?
@Xeo No longer a default, but yeah, that's not a stopping issue.
 
@sehe I have no expectations, but I can be hopeful :)
 
std::function<void()> x = f; works too.
 
12:41 PM
Is this snippet impenetrable?
 
@LucDanton it's illegible
 
@R.MartinhoFernandes That's more of a surprise, to me.
 
@R.MartinhoFernandes Yes, that fix.
 
12:42 PM
Well the polytypic variadic version but you know.
 
Is this the mutual recursion thing you were wondering about earlier?
 
Xeo
@R.MartinhoFernandes No?
 
I'm wondering if a well-done example can help.
 
@Xeo Why not?
 
What is the other C++
 
12:43 PM
f is callable<void()>
 
@Pawnguy7 what
 
Xeo
@R.MartinhoFernandes So long you don't pass it anywhere.
 

C++

Friendly conversation, including C++ talk — NOT the "Lounge"!
 
Xeo
Since then you get a reference / pointer to function, which doesn't have default arguments.
 
12:44 PM
f, the name, is callable void(). But you can't pass names.
 
Xeo
std::function<void()> x = []f; would work
 
@Xeo Oh right. Suckage/
 
Xeo
@LucDanton yet!
 
@R.MartinhoFernandes Don't you mean... Fuck you C++?
 
12:45 PM
@Pawnguy7 I think the description is pretty accurate
 
@Pawnguy7 A C++ chat room.
The "Lounge<C++>" (sometimes known by other names) is not a C++ chat room, but a general chat room and venue for trolling, which happens to be populated mostly by SO users active in the tag.
 
Maybe we could invite all the C++ newbs to tomalak's other C++ room
They would be so happy there
All mentored by tomalak
 
@LightnessRacesinOrbit hahahah
 
@LightnessRacesinOrbit not everyone is like you tomalak
poor tomalak, even Tony is laughing at you
 
@R.MartinhoFernandes Anyway, in case you missed it.
 
12:51 PM
@Telkitty猫咪咪 At least the other room is free from you
 
@BartekBanachewicz does SRP apply to everything?
 
@LightnessRacesinOrbit it should be lonely there
 
@Pawnguy7 it does not apply to this:
 
@BartekBanachewicz is free from almost everyone else on earth too!
legend!
 
@Telkitty猫咪咪 I am particularly concerned about being free from the particularly annoying part of people on Earth
@Pawnguy7 I think I should write a blog post about SRP :F
I'll add that to the list of ideas
 
@R.MartinhoFernandes oh how handy (both the image and what it contains)
 
so swiss army knife is a bad object?
 
Blog? Anyway, that is my point. To me, the World storing both the data and drawing it violates it, so I was wondering if it either didn't apply, it was considered narrow enough, or holding memory is so common it isn't a defining feature.
 
That thing actually exists, and is not just something 'shopped for effect.
 
@R.MartinhoFernandes for demo purposes vOv
@Pawnguy7 it always depends on context
 
12:56 PM
@Pawnguy7 depens on what the data is but you could always have a WorldDrawer
 
@A.H. no. SRP is a guideline, not a golden rule
 
I think it's a golden rule.
Violating SRP or DRY is pretty hard to justify.
 
@A.H. it has one single responsibility: in a small, compact volume, expose the most frequently used tools needed for... uh... someone trying to build a house in the middle of a forest.
 
@R.MartinhoFernandes hm, you are certainly less wrong than me here. Again, depends on context.
 
@jalf that makes sense
 
12:58 PM
@A.H. look how overblown tool like that is causing more problems than help, really
 
I'm not sure if that's the best example of its purpose, but it is a pretty lean, streamlined collection of tools designed for one specific audience
 
splitting it into separate parts would probably make it easier to use, no? :)
 
@BartekBanachewicz but harder to carry I guess\
 
@A.H. you'd need a bag of sort.
 
I believe its called a toolbox
 
12:59 PM
SRP?
 

« first day (1026 days earlier)      last day (3928 days later) »