« first day (559 days earlier)      last day (4379 days later) » 

8:00 PM
The only file that is actually using boost::asio is the DataListener
 
Answer profoundness level: Cat Plus Plus
 
@ScarletAmaranth One Piece is full of absurdly extreme emotional scenes. I read that the author is only able to write them when sleep deprived.
 
and with that Makefile I am getting the error:
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
__static_initialization_and_destruction_0(int, int) in DataListener.o
boost::system::error_code::error_code() in DataListener.o
boost::asio::error::get_system_category() in DataListener.o
"boost::system::generic_category()", referenced from:
__static_initialization_and_destruction_0(int, int) in DataListener.o
ld: symbol(s) not found for architecture x86_64
 
OMG the Ubuntu folks finally got over the their anti Windows key fear!!
 
Which basically means the linker doesn't understand my -L option
 
8:01 PM
windows key now opens the main menu
 
@StackedCrooked I don't really enjoy such parts ... i enjoy the idea of "colorfulness" of personalities. Everyone is a very unique character with a unique background, more often than not reflecting real life very well.
 
@ManofOneWay -L only adds directories to search, are you also using -l (lowercase ell) to link to the library itself?
 
@ScarletAmaranth Neither do I really, but sometimes it's cool, like when he punched the noble guy.
 
@Collin I'm using -lboost_system as a compiler option, if that's what you mean
 
@StackedCrooked Yeah that was a great emphasis of his character and personality. Such actions define him.
 
8:05 PM
0
A: Is it possible to obtain a pointer to the defintion of a pure virtual function?

Cheers and hth. - AlfAs James McNellis commented the short answer is just "no". The longer answer is, "if you're willing to accept some formal UB, then": #include <iostream> #include <algorithm> // for_each #include <functional> // mem_fn using namespace std; struct Base { virtual void ...

 
@StackedCrooked I also like the fact that he never kills people. He prefers to watch their dreams shatter to pieces.
 
@ManofOneWay oh, sorry I didn't scroll up far enough
 
Ahh.. adding -lboost_system to the
world: $(OBJS)
$(LD) $(LDFLAGS) -lboost_system $(OBJS) -o $(EXEC)
made it work
 
^ I started thinking, maybe I should not mentioned such hack?
 
@ManofOneWay Yeah, it would need to link the library when it's doing the program link
@ManofOneWay If you're just compiling, the link flags would be ignored
 
8:06 PM
However, I still don't understand when I need to add the -L and -l respectively. Do I need to add it just there or in the DataListener.o as well?
ah okey
 
@CheersandhthAlf Eh, I think you made the warranty clear enough, it's nice to show interesting ideas.
 
@CheersandhthAlf Holy Moly that would actually work ...
 
Right, it's not doing any linking at that point, when it's building DataListener.o, it only needs the headers
 
@Collin Great, thanks a lot!
 
no problem
 
8:11 PM
ubuntu already goes on my nerves
i assign win-t to open a terminal in the keyboard preferences
then i press it and it opens the trash
 
Checking out the new 12.04? =)
 
yes
 
If I stream to an std::ostream using std::hex, how can I make sure it always writes two hexadecimal digits, with 0 padding?
e.g. std::cout << std::hex << 2; would yield 02.
 
setw, setfill.
And you can't set maximum width, only minimum.
 
Thanks! The maximum width doesn't matter, I'm writing octets.
 
8:22 PM
@Nils get a real OS, like Windows
 
I already have it
I'm not poor like Richard Stallman :P
 
@classdaknok_t Oh, someone had a <chrono> question and I wasn't around :( For a Duration d;, you need std::chrono::duration_cast<std::chrono::duration<double, Duration::period>>(d).count();.
 
@RMartinhoFernandes I don't need it anymore. :P Thanks anyway. :)
 
Hm, just got 10k
 
@MooingDuck well I want to try out also a recent version of clang
 
8:26 PM
@Nils it builds reasonably easily in MinGW
 
@Nils I have clang on my windows.
 
ok
 
kinda slow to start up though
 
nicely integrated into vs?
 
Nothing integrates nicely into VS.
2
 
8:26 PM
@Nils "nicely" no, but I can compile my stuff with it from VS.
 
lolwut
 
@Nils VS will only debug code made by VC++ as far as I can tell.
 
ok
 
oh, no wonder I can't find clang, its on my home machine, not this one;
 
boost::asio::ip::udp::socket socket(ioService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 9870));
 
8:28 PM
Other compilers don't produce .pdbs or whatever it is VS uses.
 
man this is nasty
 
@ManofOneWay namespace ip = boost::asio::ip;
 
@ManofOneWay What RMartinho said
 
Yes sure
just saying!
nasty namespace
 
is it bad if I know that my code fails rarely, and now I have a for loop seeding different values in srand to try to reproduce?
 
8:34 PM
Ow.
 
@RMartinhoFernandes Why does namespace ip = boost::asio::ip work but namespace udp = boost::asio::ip::udp doesn't? (error: 'udp' is not a namespace-name)
 
@RMartinhoFernandes I gave up
@ManofOneWay is udp a class?
 
udp is a class.
 
Ah okey
 
8:54 PM
auto dataListener = std::make_shared<DataListener>();
auto terminal = make_unique<Terminal>(dataListener);

If I want a reference to the dataListener, should I (is it possible to) have the parameter in the ctor of Terminal as const &DataListener or should I use shared_ptr<DataListener> ?
 
If you need no shared_ptr functionality, don't take shared_ptr arguments.
 
I just need a reference to it so that I can access its public methods
 
So, reference.
 
So it's possible to pass in a shared_ptr and have a reference as the argument parameter?
 
Have the client dereference the pointer, i.e. *dataListener.
 
8:59 PM
The advantage is that your function now works with anything. There's no point in limiting it to shared_ptrs.
 
Dammit my first phoenix program already requires 3 seconds to compile on my i7. That's not very promising.
 
Are you optimizing in this build?
 
No, the command line is:
g++ -o test -std=c++0x -Wall -Wextra -Werror -O0 -ggdb3 -isystem /opt/local/include main.cpp
Without the debug info it's 2 seconds.
 
I made the mistake of timing lazy-eval EDSLs with optimizations turned on once. The very aggressive optimizations took a lot of time.
 
What does a reference guarantee?
Can I pass a DataListener *d = null; Terminal(*d); (if Terminal(const DataListener &d)) or does a reference has to be a reference to an actual object?
 
9:03 PM
A reference guarantees that there is an object being referred to, although there is no guarantee for how long it will live on (and hence it can get stale). Your code is ill-formed because you dereference a null pointer, and note that happens before the reference is created.
Creating a stale reference is as easy as int& foo() { int i; return i; }
 
@ManofOneWay as long as a reference is valid, it will always refer to the same object too.
 
@ManofOneWay The reference can't be checked, so the user doesn't need to worry about whether or not he/she is required to check the validity of the incoming argument.
 
What's the usual trick to move-capture into a lambda again?
 
I think the fact that the destination of a reference can't change might enable the compiler to implement certain optimizations.
 
@RMartinhoFernandes std::bind? Well, or make_invoke.
 
9:08 PM
@RMartinhoFernandes Take the argument by value?
 
@StackedCrooked That means copy :(
@LucDanton std::bind sounds good for an answer on SO :)
 
@RMartinhoFernandes Sorry, I misunderstood. Assumed argument was a temporary.
 
4
Q: Move capture in lambda

Ethan SteinbergHow do I capture by move(also known as rvalue reference) in a C++11 lambda. I am trying to write something like this(not actual code, but similar idea): std::unique_ptr<int> myPointer(new int); std::function<void(void)> = [std::move(myPointer)]{ (*myPointer) = 4; };

 
You know, auto_ptr would actually work nicely here :S
Don't crucify me, just stating it.
 
ok so I found out that not having a degree does not disqualify me from being a prospect at FB
 
9:17 PM
auto p = make_unique<T>();
auto func = std::bind([=](std::unique_ptr<T>& p) { // by-ref or by-val?
    // blah
}, std::move(p));
 
By-ref.
 
Figured so.
 
What happens if you pass an unique_ptr like that? Shouldn't it be impossible?
 
2
A: Cheapest way of binding local variable to closure

Luc DantonThis is by design of std::bind. The full specification is in 20.8.9.1.2 Function template bind [func.bind.bind] but in this case the last bullet of paragraph 10 (which describes how the bound parameters are used) applies: — otherwise, the value is tid and its type Vi is TiD cv & So in o...

 
9:21 PM
Aren't you sharing the ptr then? Making it non-unique?
 
@ManofOneWay No.
 
@ManofOneWay No. It's moved into the function object created by bind, and its used only by that object.
 
@RMartinhoFernandes What is the use of the comma operator here? Where is p moved to?
 
@StackedCrooked It's an argument separator, not a comma operator.
Look closely, it's a call to std::bind.
 
What about: [=](std::unique_ptr<T> p) {}(std::move(p));
 
9:27 PM
That calls the lambda immediately.
 
That's invocation.
 
Ah.
Right.
Not sure if it perfectly safe, but this should work:
std::unique_ptr<int> p(new int);
auto func = std::bind([=](std::unique_ptr<int> p) { }, p.release());
 
Doesn't.
 
Indeed.
 
9:32 PM
What you want is make_invoke.
 
@LucDanton What are you working with?
 
Ok, tell me why not?
 
@ManofOneWay My own hand-rolled binder (sort of not really).
@RMartinhoFernandes No implicit conversion.
 
9:34 PM
@LucDanton What?
 
Also, someone asked me something the other day, and I figured out the answer this afternoon, and now I forgot both the answer and what it was I figured out the answer to.
 
It's like std::bind (except it's not), and it's my own.
Oh wait, I could name that thing curry. That's what it does.
 
@RMartinhoFernandes I already have a club setup for that.
 
@LucDanton Oh, but what do you do for a living?
 
Well, not entirely. Ah meh.
@ManofOneWay Student.
 
9:36 PM
@LucDanton Curry is "function -> function".
 
@LucDanton cool, may I ask how old you are?
 
@ManofOneWay Twenties.
 
Ah okey, just curious, sorry about that ;P
 
I'll be 25 tomorrow. Starting my walk toward the 30s.
 
HAPPY BIRTHDAY TO ALL THE ROBOTS
 
9:40 PM
@TonyTheLion Why? I'm sure there are plenty of them whose birthday it is not
 
I can understand the curiosity of c++11 features, but then stating "It's not available for the android NDK" strikes me as peculiar.
 
@DeadMG all the robots in this room
which is exactly one
so it's valid
 
hello folks
 
9:41 PM
Howdy.
 
Doues the Robot/Horse have a name? So we can sing to him!
 
Erm, it's right there on your screen, I guess. It's Martinho.
 
@RMartinhoFernandes Happy Birthday :) I'm heading towards 26 pretty soon :(
 
9:42 PM
me 26 soon too
lol
We should have a massive party
 
yeah!
 
PAAAAAAAAAAAAAAARRRRRRRRRRRRRTTTTTTTTTTTTTTTTTTTAAAAAAAAAAAAAAYYYYYYYYYYYYYYYYYY‌​YYYYYYYYYYY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Yeah bring out the screen
 
Ok, I'll setup a tmux session and get some drinks?
 
9:44 PM
what does the code do!
 
lol
is it valid
 
Nothing even remotely interesting
Does it call the int conversion?
 
But it does nothing. int main() {} is a valid "as-if" replacement, no?
 
is it not invalid c++?
 
9:47 PM
You said it was valid!
 
@RMartinhoFernandes he asked if it was valid, but forgot the question mark
 
I'll have to go with that it calls the int conversion operator.
 
@MooingDuck Oh.
 
@JohannesSchaublitb looks valid to me, I can't think of why it wouldn't be valid/
 
9:48 PM
this art of riddle is crude
 
Clang accepts it, GCC rejects it.
 
@MooingDuck operator T isn't a member of A.
 
A:: on the operator and it works fine with ideone too
 
why is this!?!
 
9:50 PM
@LucDanton why isn't it?
 
operator T is a dependent name!!^^11
 
What does the language rules tell us?
 
@JohannesSchaublitb Are there other names like that?
 
litb is a dependent name too
 
rolls eyes
 
9:51 PM
@JohannesSchaublitb <choke/>
 
hm but when i change it from "operator int" to "operator T" it works
 
@sehe <choke>LitB</choke>?
 
nah, that would be crude
 
@sehe Yes, my apologies, It should be done with a recursive template.
 
BTW I informed the committee about this testcase
they shall fix the spec
@CaptainGiraffe it's two phase name lookup!
unqualified lookup is only done in the definition context
 
9:56 PM
@JohannesSchaublitb Yes, the fix was intuitive enough to find, but the reason you stated was not.
 
> The reaction time of a fly is so fast that it can dodge falling raindrops
 
@TonyTheLion or maybe the fly is too light, that the raindrops air pressure wave easily moves a fly.
 
the problem is that conversion function names equality is semantic, not depending on the form
 
9:59 PM
@JohannesSchaublitb Neat sample, your minimal sample wizardry is astounding to me.
 
@TonyTheLion Let's not forget that he will probably be helped by the pressure of the airwave being pushed forward by said raindrop. It will probably prove rather hard for th fly to stay put in the advent of a speeding raindrop.
Now, what would be miraculous, if a fly can consistently dodge all raindrops after prolonged flight in medium to heavy rainfall
 
"He"? Flies are female.
 
@sehe Those are not flies, those are NSA drones =)
 
Statistics would suggest that the chance of the fly having momentum from a previous 'pushover' by a tiny shockwave (+ added reflexes from the fly himself) that another drop will catch him at a moment where he/she is unable to respond, or the change of direction takes too long.
(now, inuitive statistics suck. So, we'd need to know more about showers. I bet raindrops aren't nearly as randomly distributed in an average rainstorm as wwe might think)
 
10:02 PM
What would be the semantics for an iterator of an N-ary tree?
I woudl expect that ++it navigates horizontally.
 
@StackedCrooked You would have to decide on the traversal first
 
Width first.
 
inorder?
 
@StackedCrooked width first is hard to program for an iterator isn't it?
 
Actually, no, it's depth first.
I want to find cycles in a graph.
 
10:03 PM
@StackedCrooked there ya go, then it should be just like the binary tree iterator
 
Make iterator tree::inorder_begin(), iterator tree::preorder_begin(), iterator tree::postorder_begin() functions.
 
@StackedCrooked In, pre or postorder
 
You can provide different iterators for different traversals.
 
@LucDanton Ah, that makes sense.
 
Or just the one iterator for just the one traversal you care about but with an explicit name. Then no surprises as to what ++it does.
 
10:05 PM
Gentlemen please please help me with this problem stackoverflow.com/questions/10354786/…
 
@StackedCrooked An iterator is by definition a bad way to detect cycles
 
> You can swim up a blue whale's vagina.
how random
 
@CaptainGiraffe By what definition?
Iterator: a bad way to detect cycles. ?
 
random access iterators are an excellent way to detect cycles
 
@TonyTheLion I don't think that would ever happen by accident actually.
 
10:06 PM
An iterator moves over a set/sequence
not a graph
 
@RMartinhoFernandes I like the way BGL does it: you fire a generic traversal algo, and pass a 'Visitor' (comparable with 'strategy' or (ugh, overused word) 'policy'). The visitor defines preorder/inorder/postorder methods. As long as everything is static and non-virtual, inlining would result in 'perfect' traversal code
 
@LucDanton lol, hope not
Can you imagine you come home one day and say, "oh, honey, I swam into a blue whale's vagina today, by accident"
 
Anyway, don't do it like some SO poster did once.
To traverse a binary tree, you would use ++ to descend left, and -- to descend right.
Or the other way around. I didn't pay much attention.
 
mm
why does -- descend?
 
@RMartinhoFernandes haha
@JohannesSchaublitb ask the OP
 
10:08 PM
@JohannesSchaublitb ** ascends ?
 
@JohannesSchaublitb How would I know? It's not like it makes sense.
 
@CaptainGiraffe ~! incends
 
when semantics flees the door, creativity always wants to have a stab at it.
 
Oh, wait, or maybe it was ++it for left, and it++ for right. All I remember is that it was mostly stupid.
 
10:10 PM
no way. link or it didn't happen
'mostly stupid' is an enormous euphemism there
 
@RMartinhoFernandes I rest my case
 
@sehe Argh, ++it (i.e. all I remember) is not easily greppable :S I'll see what I can do.
 
@RMartinhoFernandes did you comment? perhaps even answer?
 
woof woof
 
Commented. Dunno how to search by that.
 
10:11 PM
@sehe Yes the most cromulent of all graph operations.
 
@StackedCrooked The easiest way I know to do this is to attempt a topological sort. Topological sort article on wikipedia describes it.
 
@CaptainGiraffe ->* crosses the road
(cue: 'Why did ->* cross the road?')
 
Allow us to think a while.
 
@CiscoIPPhone Right, which ... involves DFS :)
 
10:13 PM
Wait, wasn't this about a tree?
 
Because the pointer to member value points to Car::crossTheRoad
 
@RMartinhoFernandes Ever seen a tree with cycles? (Bet the robot has an image of that)
 
It really embiggens the entire vocabulary. It's nothing like template <typename T> envolutioning C { T ( t t) { t++ ++T; } }
 
Toposort on a tree is just a BFS traversal.
 
10:14 PM
BFS != preorder
 
> That female Koalas have 2 vaginas.....
 
@RMartinhoFernandes But if it has possible cycles it's not strictly a tree, right?
 
@CaptainGiraffe that's a big syntax mess
@TonyTheLion But you can't easily swim into them, by accident
 
What?
@CiscoIPPhone That's why I am confused now.
 
@sehe no, you'd have to decide which to swim into :PP
 
10:15 PM
@RMartinhoFernandes I'd think DFS
 
@sehe Let's not be afraid of our auras, we have 90% of our brains that are unexplored (For future reference, this is a Joke!)
 
I missed the part where it starting to be about trees.
 
@TonyTheLion Zing!
 
i think it is neither DFS or BFS
it isn't deterministic
 
@JohannesSchaublitb Either works.
 
10:17 PM
@RMartinhoFernandes ah. my petty brain doesn't conjure up tree traversals at my bidding
 
ARAghg why are there sooo many questions with barely nothing more than "binary tree" in the title?
 
@sehe I think Johannes does
 
@CaptainGiraffe Nice joke. I wonder what it is about.
 
@sehe I'm curious too
 
10:18 PM
@CaptainGiraffe The robot gave more evidence of such a thing (unsurprisingly)
@CaptainGiraffe I'd switch to green tea by now
 
@sehe I guess I'd need to use the SQL to find this. So, no dice.
 
@sehe Isn't that poisonous?
 
Water is poisonous
I don't suggest you take the lethal dose
 
@sehe Tried that once, no fun at all
@sehe They told me it was cocaine!
 
And I can't order by votes ascending (I know for sure that the question had negative votes).
 
10:21 PM
Well, I should probably not have paid so much attention to the bubbles.
 
@sehe !
Vim hates me :(
 
Hm. Is there a prettier way to do something like #define ASSERT_NO_EXCEPT(expr) static_assert(noexcept(expr), "oops"); expr; ?
 
@unNaturhal Oh good, you're learning
 
@unNaturhal you can always :help 55 wq!
 
What's 55 for?
 
10:24 PM
to quit 55 times?
 
@sehe Yeah, I'm learning.. But it is so powerfull, and with great powers comes great resposibility :O
 
and also write the same file, but I guess vim optimises that to 1 write
 
@aschepler I don't think it is ugly without the macro.
 
@unNaturhal And a lot of fun learning
 
@sehe (This means that I don't know how to use normal mode while I have some text selected xD)
@CaptainGiraffe Really? O_O
 
10:26 PM
I have found visual mode sometimes helps
 
@RMartinhoFernandes well, I'd rather not type out a long statement twice
 
@unNaturhal Or so they told ya. Trust me kid, great power isn't all it's cracked up to be.
 
You meanie!
 
@CaptainGiraffe I use gVim, and I read the entire tutorial, but I think that is just a very small part of the Vim power
 
with selected text (usually) is visual mode.
It is possible to have a 'separate' mouse selection, but I never use it. My mousemodel is such, that mouse selections are visual (char-wise) selections too
 
10:27 PM
@RMartinhoFernandes 404
 
@aschepler Oh, I missed the expr; part at the end (it ends up on the next line on my screen :S)
Oh dammit.
 
@RMartinhoFernandes ???
 
@unNaturhal Yes there is so much to it, just yesterday I ad 2 hotkeys for sql statements, subbing 2 lines in a row
 
LOL
 
10:29 PM
@CaptainGiraffe Google betrayed me!
 
@CaptainGiraffe subbing?
 
:s/XXX/YYY/
 
@CaptainGiraffe :.,+1s/XXX/YYY/ ?
 
I tried to post a link to TVTropes without taking it directly from the address bar to avoid trapping myself in, and it didn't work :(
 
Yep, on a hotkey at the same time inserting idint(11) stuff
 
10:31 PM
However, doing what @sehe said yesterday I have sooome problems xD
1. Select text (the entire file)
2. Type :=
.....puff! File empty! xD
 
@RMartinhoFernandes Tip: store them in a vim document (or notepad, for that matter). Makes for easy incremental search too. Or: make bookmarks and use the address bar to filter (but don't press Enter)
@unNaturhal If you select the file, use just =
@unNaturhal Oh, ffs. You're on windows?
 
Is the same :P
Having some text selected, it's like if you was in Insert mode, so whatever you write will ovewrite the selection
 
@unNaturhal Oh "select" mode?
That sucks.
I use visual.
 
@unNaturhal Type :behave xterm
 
@RMartinhoFernandes Select? What do you mean?
 
10:34 PM
Then retry.
 
LOL
Will not work, but I will try xD
 
@unNaturhal When you select the text, isn't there a line on the bottom saying "select" , or "insert (select)" or whatever it is?
 
(I'm trying right now)
 
@sehe On my usual machine I can just type trope <tropename> and it's in the history (not sure if I should be proud of that). Bookmarks to TVTropes? Are you insane? On this one I had to Google :S
 
@unNaturhal One piece of advice: :tabedit $MYVIMRC | g/\cwin/d | %:s/behave mswin/behave xterm/g | wq and restart
 
10:35 PM
@RMartinhoFernandes Yeah, there is. And hitting ESC will deselect all
 
@unNaturhal Fix one line up :)
 
Right, that means you're using select mode.
Visual mode is the one you want.
 
@sehe O_O And then the world implode? xD
 
@unNaturhal Nope. You get Vim behaviour like it should be, not crippled with supposed 'user-friendly' windowsy-compat crap stuff
 
@sehe Okok, wait just one second :P
 
10:38 PM
	Possible values:
	   mouse	when using the mouse
	   key		when using shifted special keys
	   cmd		when using "v", "V" or CTRL-V
	See |Select-mode|.
	The 'selectmode' option is set by the |:behave| command.
 
Ok, i'm getting annoyed with these std::array<> things. How can i initialize an std::array<T, nU> with n new objects of type T ?
 
@ScarletAmaranth std::fill? std::generate?
 
std::array<T, N> a = {{}};
 
@RMartinhoFernandes depends on the type T (mostly, constructor availability)
 
Thanks. I was 1 step away from being a blasphemous individual using T x[n];
 
10:40 PM
@sehe std::array<T, N> a = { T(...), T(...), ... }; if you want to use other ctors.
 
Thanx.
 
@RMartinhoFernandes haha. Scales nicely.
 
@sehe If they can't be generated, there's no other option.
 
@RMartinhoFernandes I think my suggestion std::generate stands. Works well even if T is actually a (smart) pointer
@RMartinhoFernandes std::generate(std::begin(arr),std::end(arr), []() { return std::make_shared<X>("bla"); }
 
Right, but that means they can be generated and must be default-constructible anyway.
 
10:44 PM
@RMartinhoFernandes I didn't just mean 'what if there is no default constructor' - I also meant 'what if the default constructor doesn't serve the purpose' (and the array is >100 elements :))
 
30 mins ago, by Tony The Lion
@sehe no, you'd have to decide which to swim into :PP
This looks so innocent in the starboard.
Anyway, sleepy time.
 
10:57 PM
@RMartinhoFernandes You star it as well, give people incentive to look for the context :)
 
kk im gonna take a look at it ^^
 

« first day (559 days earlier)      last day (4379 days later) »