« first day (748 days earlier)      last day (4204 days later) » 

9:00 PM
some of you C++ uber nerds probably had several orgasms during that Build talk. :P
 
@DeadMG but no initializer lists yet, don't get too excited :)
 
Xeo
@melak47 No, they're there.
Just the stdlib doesn't use them yet.
 
@Xeo huh, guy in the vid said that hadn't been done yet.
 
now range based loops
 
oh, yeah, that.
 
9:00 PM
@DeadMG did they say when? VS 2014?
 
@MooingDuck now
 
@melak47 "now" is not a version.
 
@MooingDuck it's available for download for VS '12 now
 
Xeo
missing http://
 
9:01 PM
@melak47 VS12? YES!
 
@TonyTheLion don't we have those yet?
 
@melak47 oh we may have done, I don't have VS2012 installed here
just dling it now
 
@TonyTheLion didn't we have those in VS10?
wwait, now I'm mixing years and versions again
 
The live streaming URL, I bet it was posted
But found it I have not
 
std::vector<int> vec;
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
vec.push_back(4);

for (auto x : vec)
{
std::cout << x;
}
 
9:05 PM
oh
 
works fine.
 
@sehe it's finished
you're too late
 
@melak47 Painful with the missing initialize_list constructor
 
@sehe yep :(
 
@TonyTheLion And what about the Q&A?
 
9:05 PM
@sehe Q&A to come soon
here ^
 
@TonyTheLion So..... care to share the URL?
@TonyTheLion Thanks
 
@melak47 std::vector<int> vec(boost::counting_iterator<int>(1), boost::counting_iterator<int>(5)); (Whee boost!)
 
> I've been following the excelent Coursera course on Functional Programming Principles in Scala led by Martin Odersky. This was not my first encounter with Scala as I've been using it including for my day job. In parallel, because I felt the need for a Javascript replacement, I've been learning Clojure too, because of the excelent ClojureScript.
> I've fallen in love with both and I can't really pick a favorite. For what is worth this document represents my (rookie) experience with Scala, being complete yack shaving on my part, or you could call it the intellectual masturbation of a fool.
 
@sehe :)
 
std::vector<int> vec(boost::counting_iterator<int>(1), boost::counting_iterator<int>(5));
std::vector<int> vec; vec.push_back(1); vec.push_back(2); vec.push_back(3); vec.push_back(4);
 
9:09 PM
@sehe And you're not gonna have that with the update either. The VC++ blog article mentions that the CTP only updates the compiler, not the standard library.
 
@melak47 Markdown has problems with multi-line messages.
 
almost not worth it, length-wise :p
 
@Praetorian That was the point
 
@sehe :) Should've scrolled up some more I guess
 
@melak47 auto r = boost::irange(1,5); std::vector<int> vec(std::begin(r), std::end(r));
 
9:10 PM
@melak47 if you want shorter length, use a typedef. It's better because it's less error prone.
@melak47 also: scale it up to 100
 
Xeo
@sehe auto v = boost::copy_range<std::vector<int>>(boost::irange(1,5));
 
@TonyTheLion I would have, but there was no Haskell in the talk :(
 
@Cheersandhth.-Alf finally now my solution is fixed!
 
@MooingDuck yeah ok :p
 
@Xeo Oh. Nice touch. I dislike using back_inserters. I'm not sure whether this will allocate just once?
 
Xeo
9:13 PM
@sehe Sure will, it's basically the short form of what you wrote.
It's create the vector through its iterator range constructor
 
@Xeo Great. It's a keeper
 
@JohannesSchaub-litb that is great. but i had an idea. because the most common use i can think of for such a variable is like a with statement in Python or using statement in C#, and isn't it possible to abuse just a little macro machinery + perhaps a double for loop or something, to do that?
i'm thinking if one writes
with( Blah( foo, bar ) ) { ... }
it would be translated to something like
 
Xeo
for(auto&& _x_ ## __COUNTER__ : wrap(Blah( foo, bar )))?
 
well i'm struggling to make the double for loop thing
the idea is to introduce control variable in outer loop
and reset it in inner loop
so that only executes once
but the editing here fails me :-)
 
Xeo
#define with(var) \
  if(bool _b_ = false) {} else \
  for(auto&& _v_ = var; !_b_; _b_ = true)
 
9:19 PM
oh it needs not be reset in the inner loop
 
Xeo
(learned that trick from BOOST_FOREACH)
 
@Cheersandhth.-Alf sounds like you are looking for stackoverflow.com/questions/2419650/…
26
A: C/C++ macro/template blackmagic to generate unique name

Johannes Schaub - litbI would not do this personally but just come up with unique names. But if you want to do it, one way is to use a combination of if and for: #define FOR_BLOCK(DECL) if(bool _c_ = false) ; else for(DECL;!_c_;_c_=true) You can use it like FOR_BLOCK(GlTranslate t(1.0, 0.0, 0.0)) { FOR_BLOCK(GlT...

 
well note the MS __COUNTER__ at least used to act up if used option for edit-and-continue support
 
9:21 PM
edit-and-continue acting up - no kidding. I'm not surprised
 
well it affected the value of __COUNTER__
seems to work OK with msvc 11.0 though
 
oh lawd
 
s/fap/fat/?
 
oh dear
 
@TonyTheLion friending your mom on facebook, using facebook at all, and posting that kind of crap on there? oh dear indeed :p
 
9:31 PM
made me laugh though
I think Q&A is up next
 
It's starting
 
rofl
my question!
 
@DeadMG has a question.
:P
go write a proposal
 
well, that's certainly explicative
 
9:39 PM
yes
isocpp.org FTW
 
I like how the MSVC team managed to deliver basically no new C++11 functionality in VC11 or the two years leading up to it. And now in what, 3 months or so, they're able to deliver a pretty major list of new features
 
@DeadMG my wife was surprised - i said hey - that's DeadMG. I'm watching the stream on the big tele in the living room :)
 
@jalf it's called a change in attitude. :)
 
@jalf It probably just wasn't quite ready yet.
 
@sehe your wife knows about the puppy?
 
9:42 PM
was I like, the only guy to submit a question?
 
seems like
now he's gone off on a tangent
 
Xeo
@DeadMG What did you ask?
 
I asked if the Committee would accept a high-quality replacement I/O library.
 
Xeo
Aw, I missed the first minutes of the Q&A so I missed the answer.
 
ah, there are other "Upcoming Questions"
 
9:44 PM
you think that girl's excited about C++, too? :p
 
@Xeo You can always rewind, you know?
Ha ha, jumping people in the background :)
 
Xeo
@FredOverflow I will at the end.
 
@DeadMG ooh, what was the answer?
 
@jalf Yes, in a word.
now I'mma writing me a proposal :P
 
@DeadMG sweet, get cracking then!
 
Xeo
9:46 PM
@FredOverflow I'm waiting for a kid to press its nose against the windows in the background. :P
 
@DeadMG use an overloadable function, not an operator, so we can have default parameters for options
 
@MooingDuck Planning on it.
 
Fernando's question....anybody we know?
 
I tried to make a replacement IO library, but didn't think some parts through, and tried to make it mostly backwards compatible. Ended up lousy, confusing, and slow.
 
Xeo
We only have a Martinho Fernandes
 
9:48 PM
oh my, await!
 
> What is the future of MFC? It has fallen behind and is not in modern C++ style.
I submitted another question about LLVM and native code generation
 
@Xeo Where is he?
 
@DeadMG At one point they said they were going to update MFC. AFAIK, they've never retracted that claim, but I'd be surprised to see it happen either. I suspect if you really pushed them on it, they'd say "yes, we did that. It's called .NET"
 
Xeo
No idea, recovering from his first work day? :P
 
@JerryCoffin I didn't submit that question. Someone else did.
it's upcomign
 
Xeo
9:53 PM
lol, "very problematic".
Gnaah, my stream is buffering so much...
 
10:14 PM
GC for performance reasons? Woah
never heard that argument before
 
@TonyTheLion GC rearranges the performance. Even if it's less performant overall, it does make tight allocation loops faster.
 
awww, didn't ask about LLVM/native code generation stuff
 
@MooingDuck ahh right.
 
@TonyTheLion Depends on how you measure and what you compare against. The amortized cost of GC is way lower than that of ref-counting, for example
 
@DeadMG maybe too technical to answer on a Q&A session. Email him.
 
10:16 PM
certainly will do
 
Xeo
Aw, my modules question didn't come through.
 
@jalf I've never been able to understand how that could be. What's so expensive in terms of performance in ref counting? It's just a few additions and subtractions, no?
 
@TonyTheLion every single time you copy a pointer
 
@TonyTheLion atomic increments/decrements every time you copy the pointer, and you have to check the ref counter every time you dereference the pointer
 
@MooingDuck but it's only a copy of a pointer...
 
Xeo
10:19 PM
@TonyTheLion Atomic modifications of the ref counter.
 
@TonyTheLion which now requires you to write to a separate memory word, and lock the memory bus to do so, in order to ensure it's atomic
 
@TonyTheLion ref counting = shared_ptr remember? Even a copy must play with the bits.
 
Anyway, the point is that a GC doesn't have to do anything when dereferencing or copying the pointer
 
hmmm
but a lot goes on in a GC too
 
it just has to traverse the object graph once when it runs out of memory
 
10:20 PM
but then that's not as expensive as doing what you just described
 
@TonyTheLion right
 
ah I see.
I can think with that.
 
@TonyTheLion not really. Each live object is visited once, and all of them probably copied to a single contiguous location
 
and then everything else is reclaimed
 
10:21 PM
right
 
@jalf in the simple model yes
 
point is it doesn't have to actually visit dead objects, only the relatively few ones that are live
@MooingDuck yep, of course there are plenty of improvements to build on top of that
 
ah right
 
GC can run quite a bit faster when you have lots of garbage
it's when the objects keep surviving that you can run into problems
 
but I think the bottom line is basically that with ref-counting you have to do something extra both when reading and when copying objects. With GC, those operations have zero additional cost
 
10:22 PM
the only annoying thing about a GC is that you don't have deterministic object lifetime control
 
but in return, you have to do a GC every once in a while, but that's so rare compared to how often you dereference pointers, that it can afford to be pretty costly
 
Xeo
@TonyTheLion Sometimes, you just don't need it.
 
yeah
 
@TonyTheLion not just that. Your performance also becomes less predictable
 
right tool for the right job, and sometimes, or often, you just don't need determinism
but sometimes you do
 
10:23 PM
@DeadMG true yes
 
overall your performance might be better than with ref-counting, but you have no way to predict when a GC might run, which will stall your app for a moment
 
user406009
Is there any way to use runtime polymorphism (virtual functions) without using dynamic memory? Having every instance being contained in a std::unique_ptr seems rather wasteful.
 
@Lalaland erm no, not that I know of
 
@Lalaland Sure. Put the object somewhere else, and store a pointer to the object
 
You can always write
 
10:24 PM
as long as you ensure the object stays alive as long as it's needed
 
Base const& o = Derived();
 
where else can you store it?
on the stack?
 
@TonyTheLion where would you like? It could be on the stack, it could be static :)
there's no rule against it
 
@jalf in my room under my bed please :P
 
10:25 PM
For the purposes of polymorphism, the important part is just that you refer to it by pointer or reference. Where the object is actually located doesn't matter
 
@Cheersandhth.-Alf Nice :)
 
@Lalaland unique_ptr is probably less wasteful than you're imagining.
 
user406009
Thanks for the tips.
 
@Cheersandhth.-Alf or even simpler: Derived d; Base& b = d;
 
Or: Derived d;
 
10:26 PM
fuck polymorphism
 
@jalf how is that simpler?
 
@StackedCrooked you still need to create a pointer/reference at some point to get any kind of polymorphic behavior
 
user406009
@TonyTheLion It's either that or a giant switch statement.
 
user406009
And giant switch statements get really annoying.
 
@MooingDuck store a derived object as a derived object, and then point to that? I dunno, depends on your perspective, I guess
 
10:27 PM
@Lalaland oh giant switch statements
 
That didn't make sense.
 
btw
what's the type of a UTF-8 string literal in C++11?
 
u8?
 
i thought it's char const[N]
 
@DeadMG just ordinary char const[N]
 
10:34 PM
after all utf8 is multibyte, and one atom of them fits into a char
 
so you can't overload on "" and u"" separately?
 
just as you can't on 1 and 2 separately
 
Ah, I guess I misread. I thought you meant the prefix.
 
Xeo
Cool, STL's proposal for std::some_functor<> was voted into the standard for C++14
 
10:35 PM
std::some_functor<>?
 
Xeo
like std::less<>
Will be the polymorphic version
 
@DeadMG you can call a constexpr function. constexpr functions could dispatch depending on whether your string contains a valid utf8 encoding
 
interesting
 
Xeo
while std::less<int> will be monomorphic on int
 
oh yeah, I remember this
 
but you then need a macro to be able to use it like #define overload(x) is_utf8(x) ? utf8Overload(x) : nonUtf8Overload(x)
 
@JohannesSchaub-litb It's a constructor anyway.
 
Ell
I wonder what will happen to apple stocks
 

« first day (748 days earlier)      last day (4204 days later) »