« first day (649 days earlier)      last day (4296 days later) » 

3:00 PM
as it is reducing the number of arguments to operator+(int,int)
 
@R.MartinhoFernandes is a lambda convertible to std::function i.e. as a return type?
 
@thecoshman Now you're making it sound like partial application.
@KeithLayne Every callable is convertible to a std::function.
 
can you use a lambda with template params inside a function/whatever?
 
@R.MartinhoFernandes what does that mean? :P
9 mins ago, by R. Martinho Fernandes
@thecoshman Yes.
 
Not sure how that would be useful
 
3:03 PM
the important thing, is that you can do it, should you find you need to
 
@thecoshman Well, the two are closely related, but they're somewhat different.
They often show up together.
 
see Haskell
 
What does a templates lambda look like, because I only ever use lambdas online
Inline
 
@R.MartinhoFernandes When is the next revision?
 
@Xaade I'm thinking std::bind would probably be the way to go, I was more or less thinking out loud.
 
3:05 PM
@KianMayne They're targetting 2017.
@KeithLayne I'm not sure what that means. Can you shoot some pseudocode?
 
Xaade, I think sehe determined that you're a proud owner of a prime userid.
 
@Xaade I imagine something like template<typename T>[](T x){ print << "you passed: " << x << endl; };
 
I was talking about:
 
@thecoshman Nah, the ideas I've seen around use [](auto& x){} or just [](& x){} (I'd prefer the former).
 
@R.MartinhoFernandes hmm... would it not make more sense to stick to the same style as normal templates though?
 
3:08 PM
std::function<A(B)> foo(B b) { return [b](B b)->A{ return something with b bound; }
 
oh man, was cutting that edit tight :P
 
@thecoshman I'd hope not. I don't want lambdas to be any more verbose.
Have you seen C# lambdas?
@KeithLayne Sure, that's perfectly fine.
(Thought it would need A explicit, as it's not deducible)
 
But that seems like a better target for std::bind, don't you think?
 
@R.MartinhoFernandes true...
 
@R.MartinhoFernandes Isn't that what -> A does?
 
3:10 PM
@KeithLayne But how do you call foo? (I'm assuming it's a template)
 
oops
yeah, forgot to say template<...>
 
You could do std::function</* compute A manually here, possibly with decltype */ (B)> foo(B b) { return [b](B b) /* let the compiler infer it here */ { return something with b bound; }.
 
that to me is bad...I would have to think of a better way that didn't involve explicit template params for a function.
 
By then it'd probably be better to just write a custom function object.
 
@R.MartinhoFernandes I'm more and more starting to realize I might prefer Boost Phoenix over C++ lambdas, no matter how standard the latter may be. Obviously, I'd be using them in tandem
 
3:12 PM
so it's possible...with decltype
I was thinking about this last week:
 
@sehe The problem is that Phoenix can't do everything.
 
> Obviously, I'd be using them in tandem
 
template<typename T1, T2> ... f(T1 a, T2 b) { /* numeric ops with a & b */ }
I did three different things with it:
1) std::conditional using sizeof to pick the biggest
2) std::numeric_limits to pick the biggest max()
 
Ogonek is a nice change of pace. I was getting used to having 10 lines of TMP to compute result types and stuff for one-liner function bodies; now I have simple template "headers" (i.e. zero TMP) for function bodies that fill the screen.
 
3) std::common_type
 
3:15 PM
Any one have experiences with log4cxx in a high volume environment
 
I'm thinking in retrospect I should have used -> decltype(a something b)
 
@KeithLayne Depends.
Could be dangerous.
 
@R.MartinhoFernandes I've forgotten your project names -> project map. What's Ogonek again?
 
@SamDeHaan Unicode thingy.
 
@R.MartinhoFernandes Ah, right.
 
3:17 PM
Substitution failure may not be an error, but it's confusing as all hell!
 
@R.MartinhoFernandes I was talking about the return type, obviously. I think #1 was just bad, #2 is sorta reasonable, but #3 I don't know if it did really what I wanted.
 
@thecoshman Have you read my post about it?
 
I'll have to give that a proper read over tomorrow
 
@KeithLayne The problem is that the decltype may turn out to be a reference.
 
hmm
can't do remove_reference in there, I'm guessing
 
3:19 PM
That issue showed up with max for example.
auto max(T a, U b) -> decltype(a > b? a : b) is nasty.
 
is there a way to make the template only work with pass by value?
specialize static assert failure for a reference type?
 
@KeithLayne T is pass by value; T& is pass by lvalue reference; T&& is pass by any reference.
 
so template <typename T> will never match T&?
 
@StackedCrooked Yes, it's UB.
The class only holds a weak_ptr to itself, and shared_from_this locks it.
@KeithLayne What matters is what you put in the function arguments.
 
3:23 PM
I think I misunderstood what you said earlier. You mean the result of decltype could be a ref even if T1 and T2 are not, right?
 
"There shall be at least one shared_ptr instance p that owns &t."
 
Yeah, I'm stupid.
 
@KeithLayne The problem is that in the function a and b are lvalues.
 
@KeithLayne If you say so.
 
@EtiennedeMartel He's just starbaiting.
 
3:25 PM
@EtiennedeMartel are we feuding like rappers?
 
@KeithLayne No.
 
@R.MartinhoFernandes No, I really wasn't thinking. I prefer to starbait with more pithy comments.
@R.MartinhoFernandes um, okay? I haven't used decltype, I've always used metafunctions and such to handle return types, etc.
I guess I don't understand the significance.
 
@KeithLayne If a and b have the same type decltype(a < b? a : b) is an lvalue reference. (I think).
 
@KeithLayne it would be great if you guys could but only release your bief raps in sinppits of compliable code.
 
And in that function, that would be a reference to an argument.
 
3:30 PM
@StackedCrooked I don't get it, shouldn't p be destroyed by line 16 ?
 
oh, I really don't understand decltype. I was thinking in terms of types, not values or refs.
crap, I gotta go. I need to read about it so I can stop with the dummy questions.
 
Is it possible to send private messages to other users at SO?
 
Jul 17 at 15:42, by R. Martinho Fernandes
Pick two rooms, and assign Morse code unit values to each of them. Then invite the other to those rooms according to the message you're trying to send.
 
3:35 PM
I've almost got 200 rep today!
 
:)
My next blog post will be titled "The Rule of Zero".
 
@KeithLayne I have no clue what you are really trying to achieve, but, would this work for you:
 
What's the rule of zero?
 
    auto foo = arg1 + arg2; // truly polymorphic 'lambda'

    std::cout << "Bye" << foo("Hello world", 5) << std::endl;
    std::cout << foo(3, 100) << std::endl;
Outputs: Bye world
103
 
@sehe No, it doesn't!
@ManofOneWay Stay tuned ;)
 
3:39 PM
@ManofOneWay I'm assuming that with proper use of unique/shared ptr there should hardly ever be a need to code custom constructors/assignment ops
@R.MartinhoFernandes Oh yes it does. Just tested it
 
@sehe Hmm, perhaps your Phoenix version is buggy?
No, it's not.
I'm silly.
 
@R.MartinhoFernandes Of course. 1_50 :)
Damn liveworkspace appears to be down: isup.me/liveworkspace.org
 
For some reason I was refusing to see the 5.
 
:)
 
A fiiiiive.
 
3:41 PM
I think I might be toying with Phoenix for some real FP this holiday. @R.MartinhoFernandes Did you catch this blog post: fpcomplete.com/the-functor-pattern-in-c ?
 
Everything around us is down lately.
sscce, ideone, livespace...
 
Ew. livespace sounds like an evil crossbreed of myspace and msn live ...
 
@sehe Still haven't taken the time to read it.
 
@R.MartinhoFernandes, lol I just saw your star wars link. I remember finding out in grade 9 and being disappointed when it didn't work at school.
 
@R.MartinhoFernandes Me niether. I scanned it and saw nothing out of the ordinary, except the more prominent use of std::function. I'd want to see whether you could achieve the expressiveness from that article with the compile-time-optimizability of Phoenix
 
3:44 PM
@chris I have designer tinfoil hats for sale.
@sehe std::function as function arguments as in the post is wrong.
 
@R.MartinhoFernandes It's the exact kind of post that is the reason there should be a "When not to use std::function" rebuttal.
 
@R.MartinhoFernandes You mean, unnecessary?
 
@sehe No, I think I really mean wrong.
 
@R.MartinhoFernandes As in - won't work?!
 
@LucDanton Write one!
 
3:45 PM
@R.MartinhoFernandes After I'm done moving.
 
@sehe Yep. It will fail miserably in many common cases.
@LucDanton Moves are supposed to be efficient! ;)
 
@LucDanton Yeah that's what I thought. Somehow I frequently get this impression with Bartosz's blog. His series on concurrency also quite clearly demonstrated his /vague/ expectations about how std::thread/std::async would be supposed to behave
 
@R.MartinhoFernandes such a beautiful hack. Well, all of them.
 
Don't want to bash his blog though, I keep reading it for the 'functional' side of things
 
@sehe Anyway, while Luc writes that rebuttal, I recently wrote an answer where I had to explain this.
That grammar is wrong.
 
3:52 PM
Well, I'd say it's wonky. It looks iffy. Might be a bit troubled. But it works :)
 
Am I missing someting on: stackoverflow.com/a/11672436/168175 ?
just because a thread is runnable doesn't imply it always gets run at the earliest opportunity.
 
Yeah I don't see how that helps without luck involved.
 
@R.MartinhoFernandes I've seen the question. TL;DR the answer though.
 
It's not about thread priority AFAICS.
 
I might be a bit overworked. I'm trying to switch to vacation mode - and have failed as yet.
 
3:54 PM
Well, system-level scheduler-queue priority.
 
@sehe Hey! You TL;DR one of my answers and didn't upvote? I'm not happy.
;)
 
The idea is that one thread is privileged, so when it locks the inner mutex, non-privileged threads have to wait even if they're runnable and manage to acquire the outer mutex.
 
@R.MartinhoFernandes To be completely frank, I just upvoted it, while still not having fully read it. That's against my usual principles, but hey - I'm trying to get in vacation mode. Soooo, afk!
 
Then again I have no idea what this is for and the question is too long, so.
 
I think that's discrimination towards threads
No thread should be priviledged
 
3:58 PM
5
Q: What would cause _mm_setzero_si128() to SIGSEGV?

FredOverflowI am converting a simulator from TinyPTC to WxWidgets. Some graphics routines are optimized with SSE intrinsics. During the initialization of the GUI, the initial state is rendered once, and all of the SSE routines work perfectly. However, if I call them later from an event handler, I get a SIGSE...

found a duplicate :) voted to close
 
Why would you want to define a function outside of a class definition?
 
@R.MartinhoFernandes What's so nasty about it?
 
@KianMayne Sometimes there's no other choice.
 
@R.MartinhoFernandes In what situation?
 
@FredOverflow It returns a reference to an argument.
 
4:00 PM
@KianMayne Because not every function is part of an object. Don't let the OO purists brainwash you into thinking otherwise.
 
@KianMayne To break cyclic dependencies. I think it was the ladybug that had such an issue lately.
@FredOverflow I think he means void c::f() {} instead of class c { void f() {} };.
 
I do
 
@R.MartinhoFernandes Then std::decay it. Aren't you the master of Decay? :)
 
Hello everybody.
I'm formerly known as Jim Norton.
 
@KianMayne Oh. Well, yout get faster compile times if you separate the implementation into its own file, because you don't have to compile the function bodies over and over again.
 
4:02 PM
@Flexo you could do it with an extra non-hierarchical mutex
 
@ecatmur non-hierarchical?
 
@FredOverflow Yeah, I know that. I was using it to explain something to keith. And now I remember one case where you need decay :) : in return types.
 
43
Q: In C++ why have header files and cpp files?

CluelessI often wondered: why does C++ have header files and cpp files?

 
LPT: lock L, lock N, lock M, unlock N, {do stuff}, unlock M, unlock L
HPT: lock N, lock M, unlock N, {do stuff}, unlock M
N is the "next-turn" mutex and is non-hierarchical wrt M
very ugly, though
 
@R.MartinhoFernandes decltype(lvalue) is a reference, but decltype(variable) is a value, right?
 
4:03 PM
@FredOverflow Yeah. Messy.
 
@ecatmur it's a mutex with guaranteed order of acquisition?
 
What's **** there?
Ah.
That.
 
Just guessing myself :)
 
@Flexo yeah, like that.
 
4:05 PM
Chicken.
 
@sehe Well, I couldn't think of anything that would fit with four letters.
I suck at crossword puzzles.
 
If I wrote a quick message letting everybody know of my name change, would some room owner please pin it to the starboard for a few days?
 
@FredOverflow I see, thanks (:
 
user142019
sup
 
@R.MartinhoFernandes Oh - just that. I think you can be redeemed of that
@R.MartinhoFernandes I don't often assume that the number of asterisks is accurate
JimN changed name and persona
3
 
4:08 PM
thank you.....
 
I don't think this is really pinworthy event.
 
Wunderbar!
 
In case the link would become too googleable? Or do you prefer JimN.?
 
@sehe JimN
 
@FredOverflow the stack boundary is 16 bytes! Why is it so hard for library developers to understand that? :(
 
4:08 PM
@CatPlusPlus If you star it, I'll unpin
 
@flexo: yes you're right. But you can pthread_yield() between both locks. Fixed. — Rafael Baptista 4 mins ago
 
It's already starred.
 
sigh
 
Good
 
@CatPlusPlus Well, however it's done, I'd think people would like to know who I am now...
 
4:09 PM
Besides, cancelling pin converts it to a star.
 
@Flexo :(
 
@Flexo le sigh
 
@Chimera I'm not confused. Hey, anyone can't be bothered with reading the backlogs, kinda deserves to not-know things :)
 
I like how many people think things like sleep and yield can be dropped like hammers to solve problems.
2
 
4:10 PM
@CatPlusPlus Trivia
 
@ecatmur I don't know. I lost several hours of valuable time on this issue today.
 
@sehe That's a good point. :-)
 
I lost several hours of valuable time on sleep. I usually don't care about yielding
 
hello everyone :)
 
Hello Ninja
So I started reading Accelerated C++ last night... omg that book is so good..
 
4:13 PM
You're not supposed to eat it
 
Am I considered a regular here now?
 
No. You reverted to newbie due to the name-change
 
@sehe But that's the best to internalize the material :-)
 
But some of it is best regurgitated ruminated on ad nauseam instead of digested :_)
 
Don't eat books. Don't crease covers. Wash your hands before touching books. Keep books away from food. Don't let others near your books before they learn these rules.
 
4:14 PM
@sehe Awww shucks... :-)
 
@R.MartinhoFernandes And kids
 
@Chimera Done any exercises yet?
 
If I can, when I buy a book, I grab another copy from a library and read the library one, so I don't damage my copy.
Yes, I'm silly.
 
@FredOverflow Well I read chapter 0 and mentally did those exercises...
 
TIL: bovines ruminate their food in English
 
4:15 PM
@R.MartinhoFernandes Why don't you just not buy the book? :L
 
@KianMayne Then I couldn't have the book and read it!
 
@R.MartinhoFernandes I used to plastic-cover all my books. But that has been 20 years now :)
 
@sehe Oh god, I'd never do that.
 
That was in my most intense book-reading-collecting period though
 
@FredOverflow Chapter 0 exercises are far too easy to actually do at a computer.
 
4:17 PM
@KianMayne I like looking at shelves full of pristine books.
 
@R.MartinhoFernandes Do a partnership with Barnes & Nobles: you pay them 15€/month for unlimited webcam access to random shelves
 
There
 
Doesn't look pristine
Or books, for that matter
 
You guys will never understand. This is how the Universe works. Can't damage own books.
 
4:19 PM
@R.MartinhoFernandes Which are your favorite books?
 
@CatPlusPlus ow, I thought you unpinned. I just did that, sorry for delay
 
@Chimera did you get my message last night about a custom C++03 unique ptr using just swap
 
I don't lend books to anyone, because all my friends crease the hell out of their covers.
@ManofOneWay That's a tough question.
 
@R.MartinhoFernandes I think you may just have found the solution to the classical "Have your cake and eat it, too" problem!
 
@MooingDuck Yes I did... thank you for continuing to think about it... I'm not sure how to implement the idea though.
 
4:22 PM
@FredOverflow Borrow a cake from a bakery, and eat the one I borrowed?
 
@MooingDuck This is turning into a great learning exercise for me.
 
@R.MartinhoFernandes I don't care about wearing my books out; if they become unreadable, I'll simply buy another copy.
 
Poor things.
First you mistreat them, and then you discard them and replace them.
You're mean.
Books are people too.
 
@R.MartinhoFernandes I can't do what you do, because my library has a somewhat limited technical section. There's beginning C++, but things like templates and STL were all "out of the scope of" the books
 
@KianMayne I can't do that often either.
I had to develop techniques (if you can call it that) for limiting damage.
 
4:25 PM
@R.MartinhoFernandes I was always brought up with books being special too
I once saw someone tearing pages out of a book. The book was a crappy teenage girl love story but I was still appalled.
 
Still a better love story than Twilight.
 
@KianMayne I like that. I'd never harm my book, but I like the gesture
 
I'm doing a list of past topics with some stats.
 
@KianMayne Are you formerly know as keith.layne?
 
What stats do you want?
 
4:29 PM
@KianMayne How about using lib::tech::cpp::advanced to bring them into scope?
 
@Chimera No.
 
@Chimera Nope. Only PHP has such fuzzy matching
 
@CatPlusPlus SPECIAL?
 
@Chimera No
 
@KianMayne ok
 
4:29 PM
@Chimera No. jumps in the bandwagon
 
Phew. Glad you allow it
 
@R.MartinhoFernandes Your mom.
No, really, what stats would you like to see wrt topics.
 
What kind of stats could possibly be computed?
 
28 mins ago, by Chimera
I'm formerly known as Jim Norton.
22 mins ago, by sehe
JimN changed name and persona
Do we really need that info twice?
 
Top topic changers, highest rated topics.
 
4:30 PM
lol at someone thinking a document with Programming languages — C in big letters on the first page was C++
 
@CatPlusPlus Ah.
 
Average length of one topic (in terms of time).
 
@FredOverflow I have no clue.
 
Dumb C11 vs C++11 confusion.
 
4:31 PM
Ideas, ideas.
 
@FredOverflow I lost way more than that, couple of years back. It seemed everyone writing a managed-to-native interface was assuming 4-byte aligned stacks.
 
I'm bored.
 
@CatPlusPlus See, I made you answer your own question!
 
@Flexo take a look at my answers: stackoverflow.com/questions/11666610/…
 
@ecatmur Why didn't you edit your earlier answer?
 
4:34 PM
@Chimera I coded it up, only to remember that you need custom deleters
 
@sehe I realised that I had three different answers, and didn't really want to put up 3 separate solutions. I don't really have an opinion on what's best, tbh.
 
ok
 
Also it's quite likely that at least one of my "solutions" is erroneous and I'll have to delete or correct it :)
 
@MooingDuck Man you are awesome! I so much appreciate your willingness to help me out!
 
Tinfoil fuel @chris /cc @R.MartinhoFernandes
> Twitter is currently down for <%= reason %>
Twitter, it was written in ... <language censored>
 
4:39 PM
@sehe, lol, so it is.
 
Looks like ASP.
With unescaped nuggets.
 
reason could have been sanitized/escaped before
> We expect to be back in <%= deadline %>. For more information, check out Twitter Status. Thanks for your patience!
 
@sehe Clearly, it was escaped twice.
 
status.twitter.com - it says it has been for 57 minutes now (since officially announced)
 
@R.MartinhoFernandes You should answer this tough question. Inquiring minds, and all that.
 
4:41 PM
@R.MartinhoFernandes Oh you meant to explain the lack of interpolation. I think it will just be a missing page handler registration or something like that
 
Oh no, Twitter is down, how terrible.
 
I don't care. I'm just amused by the heroic error page
 
@SamDeHaan Ok, I'll think about it and give you my desert island list tomorrow.
 
I'm disappointed by the lack of failwhale.
 
@sehe Possibly.
 
4:43 PM
@R.MartinhoFernandes But you wouldn't take any books to a desert island, they would get sand in them. And the spines would get bent!
 
@SamDeHaan There would be no shelves there anyway.
 
@R.MartinhoFernandes True. And I would say you could build shelves, but they probably wouldn't be level anyway, so what would be the point.
 
I noticed GCC worked with #pragma once after it didn't when I tried with an old version a year or two ago. Does GCC have anything to replace #pragma comment (lib, "mylib")?
 
@CatPlusPlus It's terrible because I wanted to tweet about Twitter being down!
 
4:48 PM
Argh, why SO search has to use relative timestamps.
Well, chat search.
You're terrible, chat search.
 
You guys told me std::vector<bool> isn't that good, is it because it's not guaranteed that the elements are ordered in memory? Does that make it a non-random-access-container?
 
@sehe I wasn't actually trying to acheive anything. That would be foolish. I was just wondering aloud. I was kind of thinking about Scheme-style functions-returning-functions. I don't know that the concept really makes sense in C++ with the other facilities available.
 
Speaking of books, here is what I have at the office. some of you will HATE one of them for sure.
 
@ManofOneWay vector<bool> is not a collection of bools but a collection of bitfields
 
4:50 PM
@Chimera yeah, the eclipse one.
 
@KeithLayne Well talks about debugging techniques using GDB DDD and Eclipse.
 
@ManofOneWay, I think it was broken in 03, but fixed in 11 or something.
 
DDD....didn't know anyone still used that.
 
@chris No, nothing changed.
 
@KeithLayne I thought the JAVA one for sure! :-)
 
4:51 PM
I used to love ddd
 
yeah, in 1998
 
@R.MartinhoFernandes, really? could've sworn i remember that from somewhere on here
 
@JimNorton see what I did there?
 
@rerun When you work on embedded systems you don't always have modern debuggers to use. :-(
 
4:52 PM
@KeithLayne Yeah...
 
emacs and gdb arn't good enough
 
@Chimera Yeah, that soldering iron is a terrible read.
 
@R.MartinhoFernandes thanks for the pics of DDD boobs.
 
@SamDeHaan LOL
 
But is vector<bool> a non-random access container?
 
4:53 PM
No.
 
What if the elements are not contiguous in memory then?
 
@Chimera The soldering iron more than offset the J*** book :)
 
"Does not necessarily store its data in a single contiguous chunk of memory."
 
@rerun I still sometimes use it. It's hard to get it configured, but it's graphical 'drill through' is still sometimes convenient
@ManofOneWay vector MUST have all elements contiguosly allocated (this requirement may have been 'sharpened' in C++11, I'm not sure)
 
It needs O(1) indexing.
You cannot directly address the underlying data anyway, so being contiguous is not relevant.
@sehe Junt?
:P
 

« first day (649 days earlier)      last day (4296 days later) »