« first day (772 days earlier)      last day (4166 days later) » 

1:00 PM
@Xeo This is killing me!
 
Oh gawd.
It is.
 
So funny, now my eyes hurt
 
Xeo
@LucDanton The function param?
 
Btw, @Luc, no progress on the std::function args thingy?
 
sbi
Has anyone here looked into this book? Is it worth anything?
 
1:05 PM
@R.MartinhoFernandes Can't say I've went on with it.
 
:( cracks whip
 
sbi
In other news, if you think "Learn <programming-language> in 7 days" is stupid, you should know that there are worse. Just have a look at that book's title.
 
@sbi @jalf says it is not bad, other than the silly title.
@sbi Never heard of it. Amazon does not allow to look inside much, but the TOC seems nice (except for the fact that is not updated for C++11 yet :)
Why do you ask, btw?
 
sbi
@R.MartinhoFernandes Yeah, but @jalf's a penguin. Go figure.
@R.MartinhoFernandes Because I'd be interested to read it if it is any good.
 
it's kind of like seven minute abs
@sbi at the least, something to wipe your self with
 
1:10 PM
@sbi FWIW, it is on the "people who bought this buy good books" group on Amazon. (IME there is a strong divide on this.)
 
Does anyone have an idea as to how I can my the following code work if Base1 has a protected destructor?

Sptr<Derived> sp(new Derived);
char *buf = (char *) ::operator new(sizeof(Sptr<Base1>));
Sptr<Base1> &sp2 = *(new (buf) Sptr<Base1>());
sp2 = sp;
sp2 = sp2;
sp.reset();
sp2.reset();

(Sptr is a smart pointer that I have to write)
 
sbi
@R.MartinhoFernandes ??
 
What. (Fixed link)
 
@sbi If you look at the page for a bad book, Amazon will show you a list of bad books claiming that's what people who looked at that bad book also bought. If you do it with one of the known good books, the list contains almost only good books.
The list for this one contains many of the known good ones.
 
sbi
@R.MartinhoFernandes Ah, I see. Well, I found it off that same list at one of the good books, so that isn't too surprising. :)
@thecoshman I prefer toilet paper, as it is softer.
How do I iterate over a tuple's content in C++03 (no variadic templates)?
Let's say I want to print all values. How do I do that?
 
1:15 PM
Manually?
Recursion.
(Boost.Fusion)
 
@sbi surely any form of paper is a step up free leaves?
 
sbi
@R.MartinhoFernandes Rarely had I laughed that heartily.
 
@sbi What?
I am serious.
 
sbi
@R.MartinhoFernandes Well, then pester Björn. please, so that he makes time to get us up and running with boost.
@R.MartinhoFernandes Well, I know the basics. Only last time I dealt with tuples I wrote my own ones. :-/ How exactly to I recurse into tuples? What's the car and cdr operations? How do I get at a tuple's head and tail?
 
Xeo
19
A: Pretty-print std::tuple

XeoYou need compile-time "recursion" for that (well, it's not really recursive, the functions aren't the same): #include <tuple> #include <iostream> template<std::size_t> struct int_{}; // compile-time counter template<class Ch, class Tr, class Tuple, std::size_t I> void p...

Now substitute printing with any other operation
 
sbi
1:19 PM
@Xeo Ah, neat one! Thanks, that's what I needed. Damn, that uses variadic templates!
 
@sbi Ah, well, that would depend on what the tuples are implemented like. For the std ones (are they in TR1?) you recurse up or down the natural numbers, like you would for factorial and shit.
 
Xeo
@sbi Only for verifying that it's a tuple for the operator<<
 
sbi
@R.MartinhoFernandes Ah, so it's via get<0>()? Well, I can do that. Thanks.
 
Xeo
You can substitute the sizeof...(Args) with tuple_size<Tuple>::value
 
sbi
@Xeo Yeah, so I see now. Sorry for the hasty condemnation. (You had my upvote already anyway.)
@Xeo BTW, that would need a call widen() to be wrapped around "(" and ")", wouldn't it?
 
Xeo
1:23 PM
I have no idea what widen even does!
 
@Xeo Mwahaha, you templated on the stream's char type, and then just fed it regular chars anyway.
You suck.
@Xeo char -> wchar_t.
 
Xeo
yada yada
So yeah, it would need that.
 
You need to use the traits.
 
@Abyx Ew. For wildly varying values of "works" I guess. What was the purpose again? Performance? (nah - down the drain) Type safety? (nah, down the drain) Genericity? (nah - absent) ...
I don't see the goal here. Why not use boost::any, or your own type-erased container instead of ugly sstream roundtrips - that won't usually work. Not even for double, for example
@R.MartinhoFernandes "Use the traits, Luke"
 
No wait, the traits don't do.
The right answer is: you are screwed.
 
1:25 PM
lol
 
@sbi, "close your browser and learn by yourself cause books stinks for so long this days"
 
you know, it amazes me that anyone argues against fixing UTF-8 literals
how can you not fix them?
 
sbi
@AlbertoBonsanto I fail to parse that.
 
@DeadMG The wrong is done. You cannot fix them without a breaking change.
 
@sbi it's a poem :D
 
Xeo
1:27 PM
@R.MartinhoFernandes What about .widen, then? Isn't endl also specified to do os.put(os.widen('\n'))?
 
sbi
@AlbertoBonsanto Then you must be a Vogon.
 
@R.MartinhoFernandes I kinda disagree. There's no reason to use UTF-8 literals, even on the few compilers that support them, so I'm not exactly seeing the miles of legacy code broken.
 
@Xeo Ah, that might do it. Is there one for strings?
@sbi Ow.
 
Xeo
@R.MartinhoFernandes Nope, single chars.
 
@sbi :/
 
1:28 PM
Like I said, you are screwed.
 
sbi
@R.MartinhoFernandes It's just single chars anyway. He was only to lazy to think about using '(' instead.
 
Xeo
But the ( and ) are single chars, so meh
 
But ", " isn't!
 
Xeo
Oh, yeah, and the ", "
 
@sehe that Variant is just for testing purposes, there will be another Variant, in real code.
 
1:29 PM
Guess you are lucky because everything is on the BECS.
 
Xeo
heh
 
@Abyx You mean like, maybe, not a variant? Maybe like, either boost::any, or Tuple<...>?
 
sbi
@R.MartinhoFernandes So it's two single chars. Big deal, really.
 
Xeo
  os.put(os.widen(',')).put(os.widen(' ')) << std::get<I>(t);
Definitly looks fugly, though.
Or I could use << all the way through...
 
sbi
@Xeo That gives me nasty error messages deep from the bowels of VC10. :(
 
Xeo
1:31 PM
Or I write a widen inserter!
@sbi Lemme check.
 
@sbi Some reviews on Amazon do not please me, though.
 
@sehe it will be a variant, like a tagged union.
 
Xeo
Got a small sample code?
 
my brain hurts
 
@Abyx Wokay, that will probably serve a benefit I'm currently unable to imagine
@DeadMG Ow. That's a shame. Especially considering this is the largest part of your body
 
1:33 PM
@sehe just another scripting language
 
@sehe how do you figure that?
 
@sehe OMG, the rest of his body must be microscopic then!
 
sbi
@R.MartinhoFernandes That's why I asked.
@Xeo I am using this, only in VC10 without all the tr1 stuff.
 
@Abyx Wokay. If the set of possible argument types is known, yeah. I thought you were joining in the efforst of many here to make a fully generic 'function wrapper'
 
Personally, I would not buy it before having looked at some pages from the interesting parts.
 
Xeo
1:37 PM
> 1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
wtf.
 
@Xeo I got that some time ago
 
Xeo
What did I break now...
 
Either your PATH is mangled up either the install is broken. Good luck.
It happened after installing VS11.
 
Xeo
@sbi I originally meant to just replace std::tuple<Args...> with Tuple and class... Args with class Tuple, though you need to change it from operator<< to print or something.
@kbok I have VS11 installed. :(
But yeah, it compiles.
 
sbi
@Xeo Yeah, that's exactly what I am trying right now. :)
 
Xeo
1:39 PM
Should work fine.
 
eh, boost::serialization has a strange use of overloading operator& to serialize something
 
Xeo
Atleast you don't need to bother distinguishing between serialization and deserialization
 
@sbi You silly dirty ape: you are starting the loop out of bounds (i.e. there is no get<6>, only 0-5)
 
sbi
@Xeo Yeah, that's pretty much what I have, but VC10 is still throwing up the same error messages all over my screen.
 
@TonyTheLion strange but incredibly useful once you get the hang of it
 
Xeo
1:41 PM
Ew, he forgot the -1 in int_<... -1> yeah
 
sbi
@R.MartinhoFernandes Indeed. Slaps forehead.
 
@kbok oh right
 
That's why I prefer recursing up.
 
Xeo
Not like that changes much
Atleast not if you don't want to have an empty function
 
Why would you not want that?
 
1:44 PM
> I’m James Ladd. I’ve worked as a software developer for 30 years in over 10 languages, and still haven’t found a language more expressive, beautiful, or productive than Smalltalk.
I stopped reading here.
 
Xeo
@R.MartinhoFernandes Doesn't work so well with delimiters, does it?
(Aka not printing a trailing / leading one)
 
I think that's irrelevant.
 
sbi
Well, thanks guys, that got me started now. Off to work.
 
You solve the leading/trailing problem by special casing the first or last one.
 
Xeo
Also, when recursing down, you don't need an extra counter
 
1:45 PM
What extra counter?
It only needs one counter.
 
Xeo
sec
 
got another email, now from Google /cc @Xeo
 
Nice.
 
yea, I once again responded "maybe later" :)
 
Xeo
So my question is:

    1. What is the effect of assignment inside template?
    2. What is the purpose of using it in the above example?
    3. There is no third question.
 
1:54 PM
I'm starting next week, I'm really looking forward to see C++ written by intel devs. And I have to ask my boss if I would be able to get their... our compiler onto my private workstation
 
Xeo
@R.MartinhoFernandes It needs one for counting up, and a marker for when the upper limit is reached
So yeah, maybe "counter" was the wrong word.
 
The marker is the size of the tuple...
Those ints need to be size_t, though.
 
Xeo
Mmm, with a tag-dispatched call on every step.
Might aswell do I != 0 && print_delim(os) and trust the optimizer
 
Well, whatever works. The point is that handling delimiters is orthogonal.
 
sbi
Damn, I am in the brink of writing yet another private tuple lib.
 

« first day (772 days earlier)      last day (4166 days later) »