« first day (324 days earlier)      last day (4614 days later) » 

Als
6:00 PM
@TonyTheTiger: :)
Whats with the lame room title.
 
@Als @Mahesh for you guyz : youtube.com/watch?v=wagn8Wrmzuc
 
@MrAnubis uh :)
 
Als
@MrAnubis: Why for Us?
 
@Alf : didn't you like it?
 
Als
@MrAnubis: He is pissed you didn't tell him it was for him as well.
 
6:02 PM
@Als - Probably we are not mean to @Mr.Anubis :)
 
@MrAnubis i am confused about lady gaga, sometimes she has alien things under skin, sometimes she's a guy, i dunno
 
@Als wondering myself why for you two only
 
Als
@Mahesh: I am equally evil to everybody actually.
 
lady gaga is awesome
 
Als
@AlfPSteinbach: Why did you call her a she?
:P
 
6:03 PM
@Als : when did i say you're Angel:)
 
@Als good point
 
Als
@MrAnubis: uhm?
 
@Als pardon me
 
Vevo player is not allowed in some countries.
At least the links I send to friends, report me they have copy right issues.
 
Als
@AlfPSteinbach: I thought you checked and so the free usage of the term she
lol
did you?
 
6:04 PM
i'm too lazy
 
Als
@AlfPSteinbach: Oh even on checking such kind of a thing? ....we should get @TonyTheTiger to get it checked for us
:P
 
@Alf : how do you put youtube vid in frame?
 
Als
@MrAnubis: No rocketscience, paste the link where you type.
@AlfPSteinbach: You are scaring kids, eh
 
@Als : last time i did the same but didn't work
@Als lol
 
you mean the music? it's really good. best version of lazy i know. although some like the one on "made in japan"
 
6:07 PM
@Als what?
 
Als
@MrAnubis: Try again, and learn from mistakes.
 
I am Genius™
 
uh, I think I'm the Genius™ in this room
 
Als
@TonyTheTiger: Me and @AlfPSteinbach, were wondering if lady gaga is a she and I had a passing thought that you might want to confirm that out for us.
 
@MrAnubis - You are a very quick learner :D
 
6:09 PM
@DeadMG lol was waiting for this reply from you
 
Als
@DeadMG: You are a puppy.
 
Did you guyz like the song?
@Als: i think that pic is of his's dog
 
Als
perhaps. :)
 
@Als and he just said i am Genius™
 
Als
@MrAnubis: Yeah, lot of people say lot of things, that maybe true or maynot be true, in this case it just might be true, but it still doesn't disprove that he is a puppy
does it @DeadMG
 
6:13 PM
@Als lol
 
the point is that Genius™ is my line
 
@Als she is a she indeed, but there have been rumours she might be a hermaphrodite
 
@Als : If you were shrunk to the size of a pencil and put in a blender, how would you get out?
 
Als
@TonyTheTiger: We were hoping for a more of an penetrative inner perspective, if you gather what i mean.
:P
@MrAnubis: I wouldn't be shrunk to the size of an pencil.
 
@Als : what does that means?
@Als but just suppose , then?
 
Als
6:16 PM
@MrAnubis: Nothing much really unless you understand it and not just read it.
 
ok lemme ask another question : How do you weigh an elephant without using a weigh machine?
 
this video confuses me
 
aarrhhh i think its getting bore
 
there's dave grohl on the drums
and there's an animal driving a car
 
@Als I'm not really into Lady Gaga, she doesn't produce my kind of music and she's not my type of girl either
 
Als
6:20 PM
@TonyTheTiger: Okay, who's our other resident expert since you called it an pass..:)
 
you can put it in water (it displaces its own weight)
or you can cut it up and weight each piece
or you can use tackles and stuff to hoist it up
 
Als
ahh i am bored
i am going to call it an day folks
 
@Alf that's right answer i think sir , though i didn't know the answer myself
 
@Als are we boring yoU?
 
Als
@TonyTheTiger: Naah, I had to read something but i ended up being just here
and now i am a bit sleepy.
 
6:24 PM
@Als : what you were to read?
if you don't mind telling
GOF?
 
Als
@MrAnubis: I do mind.
bye for now folks.
 
Bye
Sweet dreams
@AlfPSteinbach : FLTK is good GUI kit sir?
 
@MrAnubis i don't know, but as i recall Bjarne Stroustrup used it in his latest book, with just a little wrapper code
 
then what GUI kit you use?
QT?
 
not antyhing in particular
 
6:29 PM
aah
@AlfPSteinbach : Do you think that there is any..any..single user on SO who can beat monsier Scott Meyers in C++ ?
 
@MrAnubis you have strange questions. scott meyers knows a lot because he's made a living of writing c++ books.
 
why would call this question strange when it is indeed very straight
 
because it's a bad question
 
Why?
 
a person should have their own ideas and have confidence in them
Scott Meyers is just a guy and can be wrong like any other
his ideas are no better than mine, or sbi's, or my mother's
 
6:34 PM
@DeadMG :i agree
 
any comparison would only make sense in the context of something much more specific- ideas, not who said themn
 
@MrAnubis in modern society we don't think in terms of "beating" someone at knowledge etc. however, it was not unusual a few hundred years ago. for example, the italian guy who everbody thinks solved 3rd degree equations, cardano, wasn't really the first. the story was complicated. but he had to show off in a knowledge contest against rival. it was usual then.
 
therefore the question is fundamentally dumb
 
it was the same with newton and leibniz (i think it was)
 
aah
 
6:37 PM
@DeadMG i agree
 
7:02 PM
@MrAnubis Herb Sutter is on SO, I'd put him on the same level as Meyers.
Of course his hair isn't as impressive, but then again his stare is very infectious.
 
Hi could anyone help me with smart/auto pointers I read an article about them a while ago but forgot again :( quick link to an article explaining them?
 
need a little help, idea how to
for(int i=0; i<m; i++)
for(int j=0; j<n; j++)
....

transform to work with for_each function
loop in loo
p
 
I think it was a blog article explaining c# devs how to use modern C++
 
Man, looking for a flat is exhausting. Especially if you need to pull resources and find more people to rent with.
@Nils What do you want to know?
 
Well there are like three types of auto/smartpointers
like shared_ptr
with examples and explanations
 
7:13 PM
unique_ptr/scoped_ptr is exclusive ownership. Object gets deleted when the smart pointer is destroyed, unless it's been moved/released. shared_ptr is shared ownership. It maintains a reference count and deletes the object when all smart pointers have been destroyed. weak_ptr is non-owning shared_ptr, i.e. it doesn't increment reference count until it's locked.
 
humm there was a really well written article on channel9 or something
but I cannot find it anymore :(
 
auto_ptr you can completely forget about.
There isn't much more involved.
 
ok
so there is unique_ptr and shared_ptr
basically
 
Yeah. weak_ptr is a complement to shared_ptr (locking weak_ptr yields shared_ptr).
 
humm doesn't anybody have a nice article in his/her bookmarks?
 
7:23 PM
@Nils I wrote something like that once. Can't remember if I said anything much about smart pointers
Actually, no, I'm pretty sure I didn't
 
damn it
i want a book or something about C++0x
 
Anyway, it's simple. unique_ptr has exclusive ownership (it owns a unique object, one that no one else has any kind of ownership over). shared_ptr has shared ownership (lots of pointers point to it, and they all own it. scoped_ptralso has exclusive ownership, but it is limited to the scope it was declared in (you can't copy or move it, so wherever it was declared, that' where it stays, and when you leave that scope, it deletes whatever it points to)
 
ok
thx will try out some examples now
 
0
A: Do the young minds need to learn the pointer concepts?

FredOverflow Why did the C master Dennis Ritchie introduce pointers in c? Because pointers are a very powerful mechanism that can be used in many ways. And why did the other programming languages like vb.net or java or c# eliminate them? Because pointers are a very dangerous mechanism that can be m...

 
as long as you can remember what they're for (and they're generally well named, so it's not hard), you can look up the specific specs when you need it
 
7:26 PM
yes they do!
 
the only exception is auto_ptr, which is badly named, and also broken and obsolete, so pretend you never heard of it. ;)
 
@Srle Depends mainly on what you do in the loop body. Can we see the complete code?
 
is there an iPhone friendly version of so?
 
@jalf auto_ptr isn't obsolete, it's deprecated ;-)
 
@FredOverflow how does that make it not obsolete?
 
7:28 PM
it's obsolete, because unique_ptr is here
 
deprecated means "don't use this, we may remove it from the standard at some point in the future". Obsolete means "don't use this, there's a superior alternative now". For auto_ptr, both statements are true, so it's both obsolete and deprecated
at least that's how I understand the two terms :)
 
and how to I use unique_ptr with clang++
have an old version
 
Oh, are both terms defined by the standard? In that case, I retract my comment.
 
no, I don't think the standard defines the term "obsolete". But common English does :)
 
@Nils Does that version support rvalue references? Without rvalue references, you cannot make unique_ptr work.
 
7:33 PM
I have no idea
but I could use the unique_ptr from boost
 
@jalf Well, in that case, I'll call auto_ptr "old-fashioned" and "outdated" ;)
 
I could turn on my windows machine
but I'm too lazy for that
 
@Nils Is your second name "Haskell"? ;)
 
I don't get it..
no
 
Haskell is a lazy functional programming language, named after logician Haskell Curry. Not that he was particularly lazy :)
 
7:35 PM
@FredOverflow haskell isn't the only (or the first) lazy language in existence, you know... ;)
 
ah
well never got a chance to learn it so far
 
and afaik, Clang doesn't yet support rvalue references :(
 
@jalf Haskell is the only lazy language in existence I know :)
 
you can try to use boost's unique_ptr, which comes pretty close semantically, or you can make do with scoped and shared pointers
 
@jalf Really? Haven't rvalue references been in the making since 2002 or something?
 
7:37 PM
so but the boost thing is the same just with support for c++ 2003?
 
@FredOverflow something like that, if not more. But Clang's main focus has been on C++03 support until recently
 
@FredOverflow In the making != in a useful, implementable state
 
@Nils Yeah, I'm not sure exactly how it differs, but it's a kind of "best effort" implementation in C++03
they can't make it exactly like the C++0x version, but they can come surprisingly close
 
@FredOverflow Nice answer , +1
 
ic
use 03 for now
 
7:40 PM
@jalf Isn't there this cool trick involving the ?: operator to detect rvalues in C++03 that BOOST_FOREACH is based upon?
 
@FredOverflow no clue :)
there might be
 
@FredOverflow, phh well something like outputs of elements of 2dim array
int nit[2][2]={....}
for(int i=0; i<2; i++)
for(int j=0; j<2; j++)
cout << niz[i][j];
 
And why do you want to convert that to std::for_each? The algorithm looks fine to me the way it is.
By the way, are you writing a Tic Tac Toe clone by any chance? :)
 
that is not problem ofcourse, but im interested in that how to write this with for_each
tic tac toe :)
 
7:47 PM
Is i<2 really correct? You are only iterating over two indexes? Or should that be i<3?
Also, the array bounds should then be 3, not 2.
If you say int nit[2][2]; you only have space for 4 elements, not 9.
49
Q: How do I use arrays in C++?

FredOverflowC++ inherited arrays from C where they are used virtually everywhere. C++ provides abstractions that are easier to use and less error-prone (std::vector<T> since C++98 and std::array<T, n> since C++0x), so the need for arrays does not arise quite as often as it does in C. However, whe...

 
no no, this is only example, nothing more, and no tic tac toe :D
 
so how do I create a simple unique ptr to a string?
unique_ptr<string> sadf = "blah"
unique_ptr<string> sPtr(new string("adsf"));
unique_ptr_test.cpp:10:5: error: too few template arguments for class template
'unique_ptr'
 
@Nils if the string is a literal, you don't. "blah" is a statically allocated string, so you can't/don't/shouldn't delete it
@Nils that one looks good to me
std::unique_ptr<std::string> p(new std::string("blah")); compiles fine for me
 
Strings are rarely allocated on heap, anyway.
std::string instances, that is.
 
@CatPlusPlus sure but just as an example
 
8:00 PM
Someone here had make_unique implementation (@Luc?), so you can write auto ptr = make_unique<std::string>("foo"); and skip some of the redundancy.
 
@Srle As long as you just want to print all the values in the 2D array one after the other, it is relatively easy:
 
#include <algorithm>
#include <iterator>
#include <iostream>
int main()
{
    int nit[2][2];
    std::copy(&nit[0][0], &nit[2][0], std::ostream_iterator<int>(std::cout, " "));
}
 
hrmm
 
shared_ptr has std::make_shared.
 
8:01 PM
@CatPlusPlus or you could rely on auto. Wouldn't that be just as good?
 
@jalf You still have to name the type twice. auto ptr = std::unique_ptr<Foo>(new Foo(...));
 
@Nils interprocess?
@CatPlusPlus ah, true
but make_shared exists for a different reason, you know :)
 
@CatPlusPlus I wrote that once, but I'm sure I was not the first one :)
8
Q: make_unique and perfect forwarding

FredOverflowWhy is there no std::make_unique function template in the standard C++0x library? I find std::unique_ptr<SomeUserDefinedType> p = new SomeUserDefinedType(1, 2, 3); a bit verbose. Wouldn't the following be much nicer? auto p = std::make_unique<SomeUserDefinedType>(1, 2, 3); This ...

 
@Nils Interprocess unique_ptr is something different. If you want unique_ptr in non-11, then boost::scoped_ptr is what you need.
 
@jalf yeah don't ask me why it is there
 
8:02 PM
thanks
 
hrmm ah
how should I know?!
 
At least I think so.
 
but thx @jalf
 
@jalf I know, but not repeating yourself is a nice property of those two. :P
 
@CatPlusPlus note that it's not quite the same thing. unique_ptr allows you to move ownership to another pointer, scoped_ptr doesn't
 
8:03 PM
@CatPlusPlus I agree
 
Well, scoped_ptr is pre-move-semantics.
 
yeah
I just mean it's a fairly important distinction for @Nils to be aware of :)
You can try playing around with home.roadrunner.com/~hinnant/unique_ptr03.html
 
I don't know, maybe that unique_ptr is actually something like std::unique_ptr.
 
That's supposed to be a pretty reasonable unique_ptr implementation in C++03
 
yes
thx for help
brb
 
8:06 PM
How come rvalue references weren't introduced into the language sooner? Wasn't it obvious from the start that C++ loved to copy objects a little too much?
 
That could be said about almost any feature of 11. :P
 
@FredOverflow honestly, I'm not sure. In ye olde OOP/C-with-classes days, it might not have been as obvious
if everything were pointers to heap-allocated objects, copying/swapping was cheap
apart from that, it's a fairly big change to the language, and C++98 was late and overloaded with new features and didn't really have room for something like that
 
E.g. they could've foreseen the need for bind or lambdas when std::for_each et al were introduced.
 
and C++03 was a tiny bugfixing thing. Next stop was C+11, where they were added ;)
and even then, it took years, and a lot of revisions, to get them right
 
@CatPlusPlus They did- they just didn't want to introduce their own solutions when third-party could have been just fine
 
8:31 PM
guys
 
9:15 PM
@CatPlusPlus I do indeed have one, but mine has all kinds of over-engineered bells and whistles.
 
9:50 PM
I've made Boost.PP version for MSVC10 based on @Fred's.
 
What's with the MAX_ARGS + 1?
Ah, N+1 overloads for 0..n arguments.
 
I know that with works on algorithm and container vector i can use pointers, but using (vector) iterators is much more efficient way ?
 
Because it generates 0-arg, too, and I think config macro is clearer if I account for that internally.
 
what's up kiddies?
 
The ceiling.
 
10:27 PM
oh yea, that is up
found a new living place yet?
 
Nope.
 
Damn.
So what are you working on?
 
I wrote this just now, and I'm currently torn between going to sleep and experimenting on something else.
 
oh I see, and what have you decided?
 
Dunno.
 
10:34 PM
lol
 
Hi
 
You too?
Someone else is talking backwards too.
 
Ebyam.
 
10:50 PM
Oh, gosh, ok, whatever, worked that out.
What do you folks think about Xcode as my IDE for class?
 
@LucDanton: does your toolbox contain a union iterator already by chance?
I don't want to have to create one myself if a good solution already exists.
 
I'm having trouble understand your question.
 
I have two maps, map<int, T> m1, m2. I want an iterator that iterates over both at once.
 
At least I don't make the connection between a DB-like view and iterating several maps at once?
 
like an SQL UNION.
Think of maps as tables.
So I want a SELECT * FROM m1 UNION m2.
 
10:54 PM
I don't have anything related on-hand though.
I'm surprised by this but Boost.Iterator doesn't seem to have anything available out of the box either.
 
(I suppose a JOIN iterator for map<Key, S> + map<Key, T> with result type tuple<S, T> would also be neat, but that's for another day.)
 
zip_iterator.
It's called zipping.
 
Let's look inside Boost.Range...
 
Well, unless I'm misreading something.
 
Zipping maps to JOIN, but not UNION.
Doesn't it?
> Function join The intention of the join function is to join two ranges into one longer range.
 
11:01 PM
Oh, UNION. So, iterator chaining.
 
Not even. Zip commutes a tuple of containers into a container of tuples, from the iterator's perspective.
JOIN would match keys.
 
I don't think I've ever needed UNION in SQL.
 
@CatPlusPlus But I want the order to be properly interleaved.
 
11:02 PM
Note sure how well it satisfies your requirements. Working with ranges is not similar to working with iterators, is it?
 
Use SQlite. :P
 
@LucDanton Well, I have lots of events that all have a timestamp and an event description, but I want to keep separate types of events in separate containers. Nonetheless, for the report I want them all in one order.
 
Oh.
That would require container support.
So I'm looking at the wrong places.
 
@LucDanton Interesting - but they wouldn't order the elements correctly, would they? My question is map-specific, I suppose.
 
@KerrekSB Nope.
But...
You could do it the other way around!
Store it all in the same map, except where you have the separate containers right now you keep shallow view of the big container instead.
That's non-trivial either though.
Psh, no idea how that would work really.
YAGNI - if displaying in order is only what you want, then just sort before displaying.
You can avoid excessive by using shallow views.
 
11:09 PM
The room's topic should really be Iff you join this room you will be in this room. Please correct the typo kthx.
 
@LucDanton Hm, I guess I could create a big temporary map when I need to report the results. None of them are huge, so that wouldn't be a problem... Oh well. I just thought it'd be cool to have some sort of databasy iterator adapters :-)
 
I think my gcc on my Mac is broken badly, and it frustrates me to no end. :(
 
Actually, my containers might not have the same mapped type, so a more general solution would be cool, where the result is a tuple of iterators, which can be "null" (i.e. m2.end()) if they're not used.
Like, std::map<K, T1> m1, ..., std::map<K, Tn> mn;.
 
I've posted a question about this long ago but never really found a solution that satisfied me.
 
Then the union iterator dereferences to tuple<m1::iterator, ..., mn::iterator>.
 
11:13 PM
@KerrekSB Should be pairs of iterators (i.e. ranges), you can't test for a singular iterator -- you need it compare it to something else.
 
@LucDanton No, wait: you have your union iterator it. Then it->first is the common key. But now you don't know in which map it matches.
So all the elements of the maps that have an entry at key it->first have the corresponding iterator set in it->second.
 
I can't compile a simple program:
 
All the other maps will have their own end iterator set at that tuple element.
 
#include <boost/program_options.hpp>

int main(int argc, char* argv[])
{
    boost::program_options::positional_options_description positional;
    return 0;
}
 
Err I meant a tuple of pairs, not a pair of something.
 
11:15 PM
Anyone here has a Mac?
 
@LucDanton I understand, but I think that's not necessary
The entire union object will be initialized with all the concrete map instances: union_iterator_base u(m1, m2, ..., mn);.
Then we have one iterator: auto it = u.begin();
Not it->first is a key value.
but it->second is a tuple of iterators, one for each map.
so auto j = std::get<0>(it->second) is an iterator to m1, and j->first == it->first (if there's a match in m1)
 
Ah, asymmetric comparison.
 
Right. If there's no match in map 1 (and in general we expect only one map to match at any given key), then j == m1.end().
The consumer could simply check each tuple element and react accordingly.
I'm having trouble writing some variadic template structure that accepts arguments (map<K, T1>, map<K, T2>, ...) and somehow defines tuple<T1, T2, ...>.
 
Probably better to go generic.
 
typename Args::mapped_type...?
 
11:28 PM
Yeah.
 
Ugg... that needs loads of partially-specialized helper functions to do all the finding. Better stick with the 2-map version for a start!
 
What finding?
 
Well, for the increment operator, you need to find the next element among the N maps
so you keep one iterator around internally for each map, but you need to check all of them for who's next
This is a total nightmare.
 
I'm not surprised @_@
 
Hehe. Would be nice to have a bunch of database-like iterators around I guess. Maybe that'd make a worthy addition to boost?
 
11:36 PM
I think I'd sooner write a new container rather than shoehorn the iterators around std::map.
 
I suppose...
 
@KerrekSB Making that Boost.Serialization-friendly would make it competitive with embedded DBs I guess.
 
@LucDanton Hmm... it's tempting just because of the conceptional appeal.
UNION and JOIN iterators for collections of maps map<K, Tn>, for arbitrary T1, T2, ....
UNIONs accumulate rows, JOINs accumulate columns.
 
Before going on about iterators I'd check what Boost.Range is doing.
I'm more interested in container-like subviews I think.
 
11:52 PM
IMO, iterators are fundamentally flawed
they're nearly always expressed in pairs as ranges- but what if you need something else to express a range? Like, say, a pair of iterators and something else?
 
That's... a weird way to point out a flaw.
 
how?
iterators are an abstraction. Let me describe a case in which they leak horrendously. Hence they suck.
not to mention the simple fact that, well, why waste your life sending around two objects instead of one?
 
'So and so does X -- but what if I need X and also Y? Then so and so doesn't fulfill what I want' I'm not saying this is what you're trying to convey but I'm having a hard time understand it.
i.e. too much 'something else'.
 
ok
 
Metasyntactic variables, aren't they called?
 
11:56 PM
imagine that I wish to pass a range to a function
let's say, e.g., std::sort
with iterators, you can only compose that range of a pair of iterators
right?
 
Yes.
 
right
but not all ranges can be composed of only two iterators
imagine that I wanted a range over something like std::vector<int>, and I wanted to range over only the distinct values
 
What is it you call a range then.
 
I guess that doesn't actually make sense in terms of sorting
 
Or, what do you want to sort?
 
11:58 PM
my point is that if you need something other than a pair of iterators to represent your range, then you can't have it
 
I have to say
When I use 'range' in the context of containers and the like
 

« first day (324 days earlier)      last day (4614 days later) »