« first day (1137 days earlier)      last day (3803 days later) » 

user1804599
2:00 PM
But backticks are meh. Use $().
 
user3010322
[non-]const member functions, and a static function, which means you could reserve space for 3 function pointers and call the right one with another function, I think.
 
user3010322
Or smush them all together, I dunno.
 
@ThePhD It doesn't fucking matter where the function pointers are.
it matters where the object you're calling them on is.
 
@rightfold I know that, my point is that fuck bash
And shell scripts in general
 
user1804599
2:01 PM
Nah.
 
user3010322
@DeadMG You can give the void* of the proper calling address or something. I dunno.
 
Also it's usually $(< foo), and bash docs don't really mention that it works with backticks too
 
user1804599
I like them.
 
You're crazy
 
@ThePhD No, you cannot. That would only work for function pointers.
@StackedCrooked Most of that is typeinfo for RTTI and exceptions.
 
user1804599
2:03 PM
Just don’t use them for anything that isn’t combining of several commands. vOv
 
user3010322
@DeadMG Aren't we talking about implementing this with onyl function pointers?
 
user3010322
Btw, that's how Callback works...
 
You want to implement std::function with just function pointers, or what
 
user1804599
There are things I’d much rather do in shellscript than in Python or whatever.
 
@ThePhD No. He was discussing implementing only the virtual functions with function pointers.
 
user3010322
2:04 PM
Something like that.
 
you still have to hold the object you're calling the virtual functions on somewhere.
 
Because that makes it kinda pointless
 
@StackedCrooked only because you use virtual functions. it'd generate stuff even without inheritance
 
user3010322
@DeadMG void* <3
 
user1804599
And for those purposes they work fine.
 
2:04 PM
if I give you a lambda with a 2KB array as a capture, you have to put that lambda somewhere.
@ThePhD You suck. And you still have to use dynamic allocation.
 
@rightfold Like what
 
user3010322
Not quite?
 
@ThePhD assume you pass a 10kb function object to a std::function constructor. std::function will have to store that object somewhere. where if not in some dynamically allocated memory?
 
user3010322
Hm.
 
@ThePhD Well you don't know the size beforehand. SBO is just a best guess.
 
user3010322
2:05 PM
True. :c
 
@DeadMG (what's SBO?)
 
user1804599
@CatPlusPlus performing simple search and replace on all files in a directory and in subdirectories.
 
@ArneMertz Small Buffer Optimization.
 
@DeadMG k thx
 
user3010322
Hm.
 
user3010322
2:06 PM
I wonder if I'm actually storing the function object beyond it's lifetime with Callback ...
 
user3010322
I think I'm not.
 
Good job
 
@StackedCrooked Also why dafuq would you inherit from F? That's insanity.
 
user3010322
But, Callback isn't mean to work with temporary function objects. It expects you to manage the lifetime and remove it when you're done.
 
user3010322
It also provides an operator== for you to directly compare 2 functions, which is different from the guarantees of std::function..
 
2:07 PM
@DeadMG Same as member.
Physical layout I mean.
 
not if you're concerned about how much junk the compiler is generating w.r.t. vtables and typeinfos and stuff.
the layout of the physical object itself is pretty similar, but the implementation of vtables isn't.
 
Xeo
@ThePhD Hmpf, I got 30 right now
 
@ThePhD There's no useful implementation for std::function.
 
Xeo
19 if I cut the seq/gen_seq stuff
 
user3010322
@Xeo Seee?!
 
user3010322
2:12 PM
It's hard as fuck.
 
conceptually, it simply doesn't make sense to go around comparing arbitrary objects.
 
user1804599
@StackedCrooked fails when F is final.
 
user1804599
NOT GENERIC ENOUGH.
 
Xeo
Ignore final classes
They don't exist :P
 
any doesn't have operator== either.
 
2:13 PM
First draft of function-pointer base solution. Generates less cruft. (Probably wrong code!)
 
Xeo
@DeadMG any could actually have it, I think
 
I'm looking at the Boost docs right now and it does not have one listed.
 
is it unacceptable to ask questions here?
^ignore
 
@frickskit that's a question
 
user3010322
@Xeo To compare 2 any's equal?
 
user3010322
2:15 PM
What does that imply?
 
and std::function is just a boost::any but the stored object must meet an additional interface constraint.
 
in fact, you could delegate to boost::any given Dead's Dynamic Cast.
 
which was previously impossible.
 
user3010322
2:17 PM
What is...
 
user3010322
the actual syntax
 
user3010322
for making functions
 
user3010322
because it's erroring me in VC++ and in GCC now
 
i.stack.imgur.com/ySJob.jpg a prank at my workplace ;0
 
@StackedCrooked Yes.
the F&& is preferred for Functor f; Functor copy(f); because f is non-const.
 
2:19 PM
I don't understand.
 
user3010322
coliru.stacked-crooked.com/a/fbe324d416e6f024 Context: f.target<R(Tn...)>() where R is the return typename, Tn... are the function arguments, and target is the target of std::function.
 
@BartoszKP lol
 
Should I remove the move-constructor?
 
user3010322
It always errors onit. :c
 
user3010322
Maybe I need better .... somewhere
 
2:21 PM
 
@StackedCrooked No, you need to constrain the perfect-forwarding functor.
 
Ah, using template <typename... U, DisableIf<is_related<optional<T>, U...>>...>
From @R.MartinhoFernandes?
 
@TonyTheLion quoted for truth :P
 
Hey, I don't have a destructor. I could just follow ro0.
 
user3010322
2:24 PM
Arrrrrgh
 
user3010322
What is this SYNTAX
 
Oh, no, F&& is also a copy-constructor.
 
> i was laying in bed with the light on and wanted to go to sleep with it off. i called my house from my cell phone and asked for myself in a disguised voice. when my mom came in to bring me the phone i asked her to turn the light out when she left. hung up both phones and went to sleep
 
user3010322
Table-flip.
 
user3010322
I give up.
 
2:26 PM
Well fuck
Talk about lazy
 
oh shit, WTL (and some other code) was broken in VC++2013 (Win SDK 8.1), because GetVersionEx was deprecated.
 
user3010322
What am I doing wrong? :c
 
this is what I've got
 
user3010322
Maybe if I move around the ...
 
assuming that boost::any were to be upgraded with Dead's Dynamic Cast.
 
2:29 PM
@DeadMG I see.
 
otherwise it can't work.
 
heap-based
 
wat?
@StackedCrooked You assume boost::any doesn't employ SBO.
 
It does?
Oh, didn't know that.
 
no idea.
 
2:30 PM
well, if you change cast into cat, casting would make purrfect sense too: dynamic cat, static cat, const cat ...
 
but my point is, that's an implementation detail which has nothing to do with function calling.
 
user3010322
@DeadMG That's actually a good name for it.
 
Xeo
@ThePhD Hmpf and hmpf.
 
@Abyx WTL?
 
2:31 PM
My primary purpose is to see if SBO-based functor would help the performance in my current project.
 
Xeo
25 lines with #include <tuple> and the seq stuff :<
 
however, one problem I'm having is that sometimes I have nested functors. Which means the small buffer can never be big enough :D
 
Xeo
Maybe STL cheated and used C++1y deduced return? that would cut a few lines for me at least.
 
@StackedCrooked Just keep increasing the buffer until your hit rate is high enough.
 
2:33 PM
but once you get past ~2-300 bytes, you won't see an improvement from SBO anyway because the cost of copying the buffer is too high.
 
Xeo
20 lines
hah
 
user3010322
I refuse to look
 
Xeo
@StackedCrooked Standard recommends a buffer large enough to store void* + 1 member-pointer IIRC
 
user3010322
Because if I do, that's cheating. :c
 
@melak47 WTL. (windows template library, a UI thingy)
 
2:34 PM
@DeadMG Currently my functor is not templatized. So nested functor means trying to fit one sbo + ptr into another sbo.
 
Xeo
@ThePhD But it's deliciously templated~
 
@StackedCrooked Oh, you mean, a Functor storing a lambda storing a Functor?
 
user3010322
Staaph. ;~;
 
yeah, that's clearly not going to be beaten by SBO.
 
@Abyx is it any good?
 
2:35 PM
@DeadMG Yep. Silly as it may seem.
 
then what I'd recommend is
you need to change your interface to try and store more than one erased object per Functor.
 
I might use boost::variant<std::function<void()>, MyFunctor>
 
after all, logically, most Functors won't occupy the whole space... only some of them will.
 
@DeadMG The buffer size as template argument should not be a big problem.
 
@melak47 well it's just a thin wrapper around WinAPI, something like a very lightweight MFC.
 
2:36 PM
I could use a factory function.
 
@StackedCrooked That could work too.
 
However, that removes the type-erasure.
It might be a big problem after all :)
Ah well, I'll figure something out.
 
Xeo
Now I really wanna see STL's tuple_cat-in-under-20-lines
 
are any of you guys on the boost developer mailing list?
 
@Xeo what do you mean? Last time i checked you had to bind the this pointer with the phoenix lambda which is extremely cumbersome compared with [&] or [=]
@DeadMG yes, why?
 
2:40 PM
@ThePhD What are you trying to do?
Just take a function pointer directly.
 
never mind.
 
user3010322
@R.MartinhoFernandes I do that already.
 
user3010322
I just want an ease-of-use for std::function
 
-1
Q: Chinese version setup program does not work in english XP

Yang LiuIt seems setup.exe in Chinese can't find Chinese folder path or file names in an English XP, is there way to solve this issue without install a Chinese XP? Many thanks!

 
Just to get back at XML library selection: so far it looks like PugiXML is doing very very well in terms of usability:
                pugi::xml_document doc;
                auto result = doc.load(response.body.c_str());
                logicErrAssert(result.status == pugi::status_ok);

                pugi::xpath_node_set entries = doc.select_nodes("/feed/entry/title/text()");
                for (auto const& entry : entries)
                    items.push_back(entry.node().value());
 
2:40 PM
@DeadMG I use it to enable signature. For example:
template<typename F>
auto dispatch(F&& f) -> std::future<decltype(f(std::declval<Internal>()))>
{
    MoveOnCopy<std::promise<decltype(f(std::declval<Internal>()))>> p;
    auto fut = p->get_future();
    queue.push(MoveOnCopy<Function>([=](){
        SetPromise(*p, f); // overloaded for void and non-void return
    }));
    return fut;
}
 
@ThePhD Please don't. That's just bad.
 
Xeo
@StackedCrooked MoveOnCopy EWWWWW
 
user3010322
@R.MartinhoFernandes Okay... :c
 
@StackedCrooked I was thinking that you could try stacking more than one of them in the same small buffer- a Functor that can have more than one signature.
 
It makes code compile that really really shouldn't.
 
Xeo
2:41 PM
Man, just use std::bind
 
@Xeo It makes a big difference.
 
Callback([&x]{ f(x); }) // compiles, blows up at runtime
 
@R.MartinhoFernandes ^^ that's pretty nifty for a single header, header-only XML lib, in my book.
 
@sehe Not sure what you're referring to.
Oh, it scrolled away.
 
Xeo
@StackedCrooked Just use std::bind or if that doesn't work, a manual functor. Really.
 
2:43 PM
Is Stack Overflow too hard to find/
 
@R.MartinhoFernandes Yeah, I figured I should draw your attention to it, considering you were so busy in fending of gratuitous uses of std::function
 
@Xeo That's not going to help, because it's the concurrent queue that doesn't use move semantics.
 
user3010322
Hey, you know that was just a usability thing.
 
@DeadMG objectively, I say the overwhelming evidence says "Yes"
 
user3010322
THe code wasn't even used. :c
 
2:44 PM
> "usability thing"
> "not even used"
 
@Xeo If usage of move-on-copy is local and encapsulated I don't see the harm.
 
user3010322
Well, now you know why it got removed!
 
user3010322
See? It all makes sense.
 
@ThePhD "compiles, blows up at runtime" doesn't sound like usability to me.
 
@ThePhD yeah sorry, haven't had a chance to look at your furryvine yet. was too busy reinstalling windows and dicking around with AngelScript
 
2:44 PM
Stop designing interfaces like it's Perl or Ruby.
 
user3010322
@melak47 Huehuehue AngelScript.
 
user3010322
@R.MartinhoFernandes q_q But.... but I've never used either q_q
 
@ThePhD what made you not consider it? the API?
 
Xeo
@StackedCrooked That's so not local. You copy the MoveOnCopy, so it moves on every copy of the lambda. Same for the Function :(
 
user3010322
@melak47 The API, 100%
 
2:45 PM
@melak47 It's awful
 
@ThePhD negative amounts are amounts too
 
user3010322
It really looked completley unweildy.
 
lol. help vampire tries upgrade to troll.
favour denied
 
"You know, this one time, this thing would be nice. Let's write it and pretend it's not a one-use thing but is instead super reusable"
 
That's PHP
 
user3010322
2:47 PM
Also, in the end, if my scripting language looks a lot like C++,
 
user3010322
then what's the point of it being a scripting language? <_>
 
@CatPlusPlus Well, that too maybe. I don't know PHP much.
 
@ThePhD Does not follow on so many levels
 
Im so pissed of at having UI and database in one course. Bloody uni
 
oh god UI and database
It's almost as if databases by themselves were useless
 
2:48 PM
@Xeo However, I assume std::bind would look something like: promise p; bind([](promise p){}, move(p)); which means I get a functor which takes promise argument. How can I erase that?
 
user3010322
They don't sound that related...
 
"User Interface and Database Design" i have exam tomorrow
 
Oh wait, the result is void()
 
user3010322
TBH, I like my Callback and CallbackEvent classes.
 
user3010322
the fact that CallbackEvent uses the function itself as the token makes me so happy. <3
 
user3010322
2:50 PM
Just like C#. <3
 
user3010322
myevent += some_func;
....
myevent -= some_func;
 
user1804599
How are you going to implement the latter? :V
 
user3010322
I already implemented it. :3c
 
user1804599
How?
 
user3010322
2:51 PM
Directly comparable functions.
 
user3010322
Using ODR and a wrapper type inside of Callback, we can have a guaranteed one-wrapper-per-function.
 
No such thing.
Well, for function pointers, yes.
 
user3010322
This breaks for lambdas (being unnamed) and function objects which have storage, but for most other things,
 
user3010322
it works like a dream. <3
 
Xeo
2:52 PM
.... what
 
That's why it's a horrible interface.
The only thing it has going for it is coolness.
 
Xeo
"for most other things" - aka, almost useless.
 
user3010322
Oh cmon. :c
 
Xeo
Since wtf do you want to do without state?
 
user3010322
Carting around tokens is so lame.
 
Xeo
2:53 PM
But it's the only thing that works
 
user3010322
Yes, and my regular version Event uses tokens like a good boy.
 
@LightnessRacesinOrbit lol "English (traditional)" and "English (simplified)" with the flags of GB and US :D
 
user3010322
But when you're feeling edgy or have specific uses,
 
user3010322
CallbackEvent <3
 
user3010322
CallbackEvent will always be my love.
 
2:55 PM
It even has a misleading name!
 
user3010322
The world may misunderstand her, but I understand her and respect her, despite her flaws.
 
user1804599
@Xeo __LINE__ :D
 
She promised you she would "callback", but sometimes, she never will :'( ... you can love her all you want to, but always prepared for her to not calling back
 
@LightnessRacesinOrbit Ugh websites that try to hijack basic browser functionality.
 
user3010322
@Telkitty She'll always callback.
 

« first day (1137 days earlier)      last day (3803 days later) »