« first day (328 days earlier)      last day (4613 days later) » 

12:00 AM
rofl
 
@DeadMG : I did not get your comment, can you please expand/explain ?
 
@Sudhi If you're limiting what the gateway can access to the message's public interface, then what exactly is the difference between allowing it the whole interface and only the parts it needs?
those other functions on the message are public anyway and can't change
so it's not like you're losing something by sending the whole object
 
@RMartinhoFernandes : ROFL @ link/comments !!
 
Passing the whole object makes versioning much less awkward. You add the v2 stuff to the message, and you update the gateway to be aware of it. No previous interface breaks.
 
I have a really quick question I hope you don't mind. I have a pointer pointing to an array and want to pass it through a funtion. arr is the name of the pointer. do I have to do int fun(int *arr) or int fun(int *arr[])
 
12:04 AM
If you pass the parts separately, you need to break the interface of send to be aware of v2 stuff. Of course, there are ways around this, but IMO they get ugly fast.
 
@DeadMG : sorry, I am a slow learner. Now let me break it down step by step. Message class hides all the implementation details behind public interface. So to access its properties one must use this public interface. Now which properties are required to send is something Gateway must decide. The message class on the other hand simply needs to provide them. To use it or not, its upto Gateway class ... am I right till here?
 
@dukevin Don't, ever, do either. Use a type-safe container- such as boost::array. As soon as you use primitive arrays, you're way out of good practices.
@Sudhi yes
 
but for proof of concept, how would i do this
 
in that case, what am I losing by passing the whole object?
@RMartinhoFernandes : very good point !
 
if you have a proper public and private interface, then nothing
 
12:08 AM
okay... so this settles the issue for me, thank you @DeadMG, @RMartinhoFernandes for your time
I guess I will extend this approach to other parts of the design as well :)
/me wonders how his life would be without SO :-/
bbye !
 
std::aligned_storage<sizeof(T[N])>::type x; or std::aligned_storage<sizeof(T)>::type x[N];?
Oh, I asked this before.
 
yeah
 
I need to sleep.
 
shouldn't aligned_storage take a type, not a size?
 
It takes two sizes.
The length of the data, and the alignment. The alignment is suitably defaulted.
 
12:17 AM
oh ok
 
I have no idea why not a type.
 
@RMartinhoFernandes You can always convert a type to an alignment with alignof, but you can't easily convert a numeric alignment to a type.
 
Oh, makes some sense.
 
man, I am so going to fail this exam
 
I assume that's bad.
 
12:21 AM
yes
 
In that case, shouldn't you be studying, or sleeping?
 
I am studying
in so far as I can force myself to view more "memorize the formula" material
a will which is rapidly decaying into zero
 
Sounds like my Statistics course.
 
ugh
if I want to know the formula, I will Google it- that is what Google is for
and then I'll implement a function with said formula and promptly forget it again
 
Well, we didn't even had to memorize the formulae for Statistics. They were given on the exam. And each exercise was like "Apply Some-Dead-Dude's method/formula to solve this".
 
12:26 AM
huh
I could totally go for something like that
 
End result: I learned absolutely nothing.
But now I really regret that.
 
if you did well then you must have learned to apply the formula
 
lol
what else were you hoping to learn?
 
How to collect stats? How to interpret stats?
 
12:28 AM
aye, those would be useful skills
but not something you would have learned if they had asked you to memorize the formula instead
 
Of course not. That would have the same net effect, with the bonus of annoying me.
Which I guess is what you're going at right now.
 
yep
 
thanks for your help earlier, gents
I'll be on my way now
 
Hi everyone!
 
12:35 AM
hi
 
what is a legitimate way to create delays in C++; granted that my executions will continue right away even if another process is hogging the CPU at that time ?
How are you @DeadMG ?
 
Usually, creating delays (i.e. the likes of sleep) is not the best choice. Can you please elaborate on what you're trying to do?
 
Sure thing. Create a fake loading message.
"Loading...." I want the dots to appear after a given time interval.
 
I suggest some kind of timer.
I remember seeing some in Boost.
 
Thanks I will have a look at that.
but isn't there anything native ?
 
12:40 AM
Standard you mean? Definitely not.
 
Yup.
 
If you don't need portability, you could use system calls.
Oh, there is sleep_for in C++11.
 
Cool!
that sounds awesome!
I was thinking about some nope machine cycles but I think that is eval, right ? [C style]
 
Empty loops are likely to be optimized away.
 
even if the compiler doesn't get them, the CPU will
 
12:44 AM
And their timing is not very controllable.
 
and even if it didn't, you could never get the right amount
 
Not that sleep_for is that good with timings.
 
you would have to use an OS API function, or a portable wrapper on it
 
even something like { a++; a-- } ?
is optimized away ?
 
haha, you would have to do much better than that to convince the compiler to not get rid of it
 
12:45 AM
@OmeidHerat Likely, that seems trivial to optimize.
 
remember that the C++ compiler is built to optimize seemingly ridiculous code as a result of template instantation and macro invocation
 
@OmeidHerat Yes, usually. If you made a as a volatile variable, however, it would tend to prevent that.
 
even so, again, you would never get the correct time
 
Nice!
its great and some how
 
no, it's just great
frankly, the idea of waiting like that is bad anyway
so I've no sympathy about compiler optimizations preventing it from being a useful tactic
 
12:48 AM
Yeah that is true though.
I am wondering if there is ways to force Compiler to not optimize some bit of code ?
 
auto dot_task = new std::thread( [=]{
    for ( int i = 0; i != num_dots; ++ i ) {
        std::this_thread::sleep_for( std::duration< int, std::ratio<5> >() );
        display_a_dot();
    }
    delete dot_task;
};
 
@OmeidHerat GCC has the -O0 flag. Not sure how unoptimized this gets.
sleep_until seems better than sleep_for to have more control over the timings.
 
there is volatile
and that's as far as it goes
 
@OmeidHerat ^ the C++11 way
 
Yay!
 
12:50 AM
uh
what's with the new and delete?
 
@DeadMG The thread deletes itself.
 
Because the thread needs to persist if the caller exits
 
In any case I'll point out that std::thread is nasty. It calls std::terminate at the slightest provokation.
 
If there's something wrong in there, please tell me; I've never used these utilities and just looked up all that stuff to learn :v)
 
std::async is a better solution.
 
12:52 AM
I thought that std::thread objects which had already been asynchronously launched could be destroyed without destroying the native thread behind them
 
@DeadMG You need to detach() them if you want to do that.
 
yeah
 
@RMartinhoFernandes Ooh, thanks for the info.
 
so it would be much cleaner to just do
std::thread( ... ).detach();
and leave the heap alone
 
I still prefer std::async.
std::thread scares me.
 
12:53 AM
that's like asend in the PPL, right?
 
Can you link me something?
I'm not familiar with the PPL.
 
Hmm, since the thread has its own state in its own object, something needs to go on the heap…
 
Yeah, detach would still leave the hidden this inside the thread argument invalid after caller exit.
But async would work because the bind object fixes the problem.
 
@DeadMG Seems somewhat similar.
std::async is basically a safe std::thread(...).detach() that can still be joined if you want.
 
That seems very similar to what @Omeid was trying to do.
 
that's why I clicked the link
 
And with timers instead of blocking.
 
I should really get to sleep
I'm not learning anything significant
 
Lolz
you get to sleep cause this `sleep` talk is so boring :)
 
1:01 AM
no, because I have an exam in 11 hours and I'm not being productive because I'm tired and the material is a pile of bullshit
 
what exam ?
 
what subjects what for ?
 
Since he needs to examine a bull's shit, I would assume veterinary medicine.
 
Hahahaha
nice logic.
 
1:42 AM
7
A: Remove first N elements from a std::vector

Mark RansomSince you mention that you want to compact memory, it would be best to copy everything to a new vector and use the swap idiom. std::vector<myvector::value_type>(myvector.begin()+N, myvector.end()).swap(myvector);

Could you comment on my comment?
 
Think not.
§5.1.1p8.
And GCC refuses it.
 
2:21 AM
kewl, I just had a legitimate use for std::uncaught_exception().
 
 
3 hours later…
5:35 AM
@Insilico Yes, your car could be anywhere...
 
6:02 AM
@kbokthe Cringing, depending on context.
 
 
2 hours later…
8:07 AM
Morning
 
Ohai
 
> 1. To shrink back, as in fear; cower.
> 2. To behave in a servile way; fawn.
Hum, this is not really what I was looking for.
Anyway, thank you for teaching me a word :)
 
What, cringing?
 
Yes.
 
I don't see it used with those meanings most of the time.
Well okay the first one actually; just realized it's 'as in fear', there's no fear that's necessarily involved.
Honestly translating words on a one-to-one (or even one-to-many) basis is something I can't do. I need context.
 
8:16 AM
Here's the context : Vous êtes navrant. Enjoy :)
 
Whoah
"I pity you"?
 
Hah, that's good!
You successfully caught the "polite insulting" aspect.
 
There's nothing polite about either though; they're both harsh.
Did you mean the formal tone?
 
Yes. I think I meant "formal".
 
8:32 AM
Today tastes like slacking.
 
morning all
 
Als
ohla
 
8:38 AM
It's rush hour!
 
seems like it
 
おはよう
 
Als
whats up Tiger? err.. Lion...Lion of Loins :P
 
not much
travelling today
 
8:41 AM
Where are you going?
If that's not asking too much.
 
Als
After two busy work days, Today. my day is hardly passing....4.5 hrs to weekend ahh
 
Puppyland.
 
heheh lol
yea, puppyland
 
Fuck, are there qualifiers like void foo() volatile&; too?
 
8:46 AM
wtf, another piece of syntactic sugar I ain't never seen
a volatile reference to foo()?
but foo() itself can't ever change, no?
 
I see, there are cv qualifiers and ref qualifiers in the grammar now.
 
@LucDanton Oh yeah, it's total anarchy now.
void foo() const volatile&&
 
but what's it for?
 
@TonyTheTiger It's like a const function.
 
that English sentence does not parse with me
 
8:48 AM
Ooops.
 
@TonyTheTiger You're familiar with cv-quals right now right?
 
void foo() const cannot be called on a non-const value. void foo() volatile cannot be called on a non-volatile value.
 
so it's really just another way of saying void foo() const;
 
struct foo { void bar(); int bar() const; };
foo f; f.bar(); const foo g; g.bar(); for instance
 
@LucDanton yea I am familiar with cv quals
 
8:49 AM
Right
 
void foo() & can only be called on lvalue refs. void foo() && can only be called on rvalue refs.
 
Let's not think about them right now and focus on the new ref qualifiers.
struct foo { void bar() &; int bar() &&; }; for instance
foo f; f.bar(); calls the void overload
 
@RMartinhoFernandes that are either const or volatile, so foo() const& is valid?
 
foo().bar(); call the int overload
 
@TonyTheTiger Yes you can mix and match. Hence "total anarchy".
 
8:51 AM
hello all
pedantry
 
-1
A: C++0x, user-defined literals with friend operator ""()

K-balloYour friend declaration would still be in the global namespace, so it will be using a reserved name. So, yes, it is breaking the rules. Now if I recall correctly user defined literal operators that do not start with an underscore are reserved as well. That would forbid user defined literal operat...

 
The only restriction is that you can't mix the 'old style' with the 'new style'
struct foo { void bar(); int bar() &; }; is not allowed.
 
quick quiz!
 
oh
oh noes, @JohannesSchaublitb is gonna quiz us
 
8:53 AM
@RMartinhoFernandes Anyway I'm preprocessing my way out of my new specializations for my with_cv_of & Co.
What did you call your own traits again?
 
struct X { X(bool); int operator()(int); }; void f() { X(f)(int()) && noexcept(8, 8); X(f)(int()) && noexcept(8); }
what do the two statemens inside f mean!
 
Haha
 
@LucDanton Initially called them same_cv, but I like with_cv_of better.
 
First one looks like a member declaration.
Second would be a statement with bool expression, no?
 
Calls noexcept() if operator() yields non-zero ?
 
8:57 AM
8 looks like a no except expression to me, so that would return true
Left hand side of the second statement being a temporary X.
 
other way around
 
How come?
If noexcept(8) is what's used to make that a member decl then why wouldn't noexcept(8, 8) achieve the same thing?
i.e. I can't make any other distinction between the two statements/declarations anyway
 
8, 8 is not a constant-expression
 
Anyway one if a declaration for a f member taking int(*)() and returning X, with ref-quals && and being noexcept.
 
Oh.
noexcept ( constant-expression )
 
9:00 AM
@JohannesSchaublitb Oh, I thought there was a comma-separated form of noexcept. I may be mistaking that with a former proposal maybe.
 
The comma operator cannot be used in a constant-expression?
 
it can
but you need to wrap (..) around it
 
Of course.
 
Anyway, did that come from the clang list?
 
9:02 AM
so the second one is ill-formed but the first statement in main is well formed.
 
hi
 
@LucDanton made it up myself xD
 
Why is it ill-formed ? I don't get it.
 
Because it declares a member function.
Inside a function.
MVP++.
 
I read it as "construct a X, then call X::operator() on it with the value 0". What have I missed ?
 
9:07 AM
it's ambiguous and will be disambiguated as a declaration and be illformed
 
@kbokthe It could be that too. But most vexing parse sucks, so it is the other.
 
@kbokthe void f() &&; is a member decl. So is void f() noexcept(8);, and then finally void f() && noexcept(8);. Now obscure the name of f and there you go.
 
But int() ?
Is X f (int()); a valid signature ?
 
i passed int() so that it is compatible with the surrounding f overloading-wise
 
void f(int()); is the same as void f(int (*)());
 
9:12 AM
didn't want to have the compiler output other unrelevant errors beside "invalid ref qualifier"
 
@LucDanton Hah, didn't knew that
 
It's in the same spirit that void f(int[]); is the same as void f(int*);.
 
also it adds to the lulz of the quiz
 
Fuck, I think I'm screwed. I'm specializing with_value_category_of for pointers to member functions but what's the right thing to do for e.g. typename with_value_category_of<void (T::*)(), Out>::type?
 
a quiz for teh lulz
 
9:15 AM
Also, what's up with the comma and wrap ?
 
Fixed
 
@LucDanton what do you mean "what is the right thing" ?
 
The name of the trait is misleading here.
I'm abusing specializations to make the trait do two jobs.
Here I'm lifting the ref qualifiers of ptmf's.
 
you want to add to Out what is in the first argument?
 
"ptmf's" You coined this right now, didn't you?
 
9:17 AM
i.e. with_value_category_of<void (T::*)() &, Out>::type is std::add_lvalue_reference<Out>::type
 
@RMartinhoFernandes No I've seen that before.
 
@LucDanton template<typename R, typename C, typename ...P> struct lulz<R (C::*)(P...)> { }; and so on
 
(The other job of the trait is that <T&&, Out>::type is Out&& etc, that's where the name came from.)
 
for &, &&, etc..
 
9:18 AM
@JohannesSchaublitb No no no, what should the result type be.
 
you could also say template<typename M, typename C> stuct lulz<M C::*, enable_if<is_function<M>>> { };
 
I'm torn between Out and Out&.
 
i think for void(C::*)() I would add nothing
 
@JohannesSchaublitb Yeah I'll probably be extending the specialization to signatures or pseudo-signatures or whatever they're called.
 
because it can be called for both lvalues and rvalues
don't understand what you mean by "pseudo signatures" :(
 
9:20 AM
void() &
 
but i don't know what you do with it so I can't know
 
void() const
I have an overload class that accepts functors and exposes several operator() that forwards to the right functor following overloading rules.
 
yeah that's a function type. identity<void()&>::type foo::* is equivalent to void(foo::*)()&
 
I've since extended the functionality to function pointers and pointer to members.
The problem is that I can't use a greedy, perfect-forwarding operator() for the pointer to member situation.
Here's what's working right now.
 
Oooh, pints.
 
9:25 AM
i did once write a class template that can be given multiple function types and a list of argument types, and it yields a meta list with the function types in the order in which they would be selected by overload resolution
if a function is selected, it is added to the list. once the first ambiguity arises for a call to the remaining functions, the algorithm stops and passes the remaining functions in a separate list.
 
Here's what I'm doing to achieve this. I'm trying to move the specializations into my traits and use some kind of Ret operator()(typename with_qualifications_of<Signature, Class>::type c, ...) instead.
@JohannesSchaublitb Is that possible at all? How do you deal with conversions?
 
@LucDanton im doing SFINAE to a class that has operator() for each function type. and they return some type that I use to identify the winning function
 
Mmmh, I'm going to try lvalue/rvalues right now and try with_cv_of alone, with two overloads for each value category.
@JohannesSchaublitb SFINAE be crazy.
 
it also has a c++03 implementation which works for some compilers with extended SFINAE. instead of perfect forwarding it uses surrogate call functions
im unsure if I still have the c++03 implementation on my disk tho
silly c++0x implementation: ideone.com/quZve
 
Why is perfect forwarding needed anyway?
Doesn't the operator() just need to match the arguments exactly?
 
9:32 AM
ah im sorry i don't mean perfect forwarding
but I mean creating the operator() with the function type I want
like, unpacking the parameter list
 
I see.
 
sbi
Unbelievably, this is SFW: tranny.org
I mean, what were they thinking?
 
looks like braindead praisers
 
@sbi I'm flabbergasted.
 
9:41 AM
Looks like a perfect way to get hits on the website!
 
@LucDanton Hits from the people they want to convert!
Astounding marketing strategy!
And it prevents what would be a sinful site from sitting there.
They're not braindead after all.
 
Ah fuck it, I'm not getting anything done :(
 
:(
take a ky to be a Lucky
 
If use a <Ret (Class::*)(Args...)> specialization, I must add 3 more for cv-quals and even more when GCC supports ref-quals.
 
so why not M Class::*
 
9:55 AM
I wanted to use instead a <Signature (Class::*)> catch-all specialization and delegate the annoying stuff to with_cv_of, but then I can't declare the operator() without the args.
 
:(
stupid that one cannot say Signature operator(); :)
 
If I make the operator() a template then overload resolution fails because several operator() ends up 'greedy'.
 
for names that can only be used for functions, they could have made an exception to the rule that dependent function types cannot declare a function if there is no function declarator
 
That would have been convenient.
 
it appeared to me that the only reason they forbid it is that Signature lulz; is too ambiguous
but for names that can only be used for functions, it's not an issue
 
9:57 AM
Second-class functions are bad :(
I remember that off-hand suggestion that cv qualifiers be allowed as template parameters. I had no idea what that would look like but now I'm longing for something like it.
 
i wonder why we can't have cv qualifiers on function types make the function type a cv-qualified type
instead of making it a totally different / unrelated type
 
Any purpose other than regularity (which is a good reason on its own)?
 
one could say that for things like void f(const identity<void()>::type) the const is not regarded redundant. as it applies to afunction type, it will be the type void() const
 
Well how is that useful?
 
then you could say template<typename T> void f(T const C::*) { } to only accept const function types.
not sure whether that's any less confusing tho :)
 
10:04 AM
Sounds arcane lol.
Anyway I'm going to write a nested class with specialization to dig my way out.
 
"What is the first letter of your father’s middle name?" wins.
 
what if your father doesn't have a middle name?
 
I like "How many times have you gotten a speeding ticket?"
 
rofl!
not many bits of entropy in the answer to that question
 
It's so secure you won't even know the answer few months later.
 
10:30 AM
lol
 
Unless you answered "5 or more".
So, now I have new term for stupid security bullshit: "smartphone friendly".
2
 
lol
 
10:52 AM
amagad, examination!
 
When is that?
 
sbi
@RMartinhoFernandes With @DeadMG, it's always too soon.
 
yeah
I have to leave in 15 minutes
 

« first day (328 days earlier)      last day (4613 days later) »