« first day (9 days earlier)      last day (3857 days later) » 

10:00 PM
Ah well ... I'll take some of the chuckling as well ... no choice at the moment at work
what's that IE plugin from google that uses chrome to render and handle the page? :)
say you refuse to work under the inhumane conditions
I could, but then they'd refuse to pay me.
lol, I was just like, bah? windows, lets try linux on this machine... turned out there was too much windows only stuff and dual screens loose there charm when your more or less exclusively working in one screen virtual box. was a netowork admin aka eater of biscuits
10:04 PM
So I was trying to think of a way of making it easier to fake variadic functions. For now, you can use Boost.PP/manual recursion to generate N variations.
I was thinking of trying to come up with some fancy code that let you define one function, but take a variadic number of arguments (type safe, though).
So you'd say something like:
template <typename Args>
void foo(VARIADIC_FUNCTION(Args)); { ... }
boost.fusion any help?
Where the macro expands to lots of details to let it work. Any immediate "proof" of impossibility?
Like void function(id firstArg, ...) but without being forced to supply firstArg?
@GMan Boost.Preprocessor lets you write such elegant code, though: stackoverflow.com/questions/3818277/… (lulz)
@JohnatCashCommons: like 0x variadic templates rather than C varargs
@GMan: generate your c++ code
10:07 PM
@GMan If you only have one typename, you're only going to take arguments of one type?
@JamesMcNellis did you align those backslashes especially for SO's answer width?
@RogerPate No...
Ok, yes. But I think it ended up being like column 78.
oh, epic question that has been the source of epic discussion with my house mate, getting REALLY nitty gritty, just what is the difference between struct and class in C++
and I mean as nitty gritty as you like
struct is six chars long
@thecoshman: struct is better
it doesn't get any grittier than that
10:13 PM
now for what causes the problems, why/how/where is it better
c++ standard says they are the same, bar public or private as default
they are almost the same: template<struct T> isn't allowed
I am fine with this, but my house mate is determined that class has some sort of extra overhead, and I fail to see whhere it can be
struct is better because using only it to define classes results in more readable and more consistent code
@James: Well the detail would be a single parameter type, but it depends on the type of arguments passed to the function. IDK, rough draft. :P
I'm sure I've posted about this on SO five or fifty times, but more than half were comments and I cba to find the answers
10:15 PM
but when you say template<class T> class in this case means data type, T can be any data type, struct class basic what ever
someone should post on prog.se
@thecoshman: yes, it's just a synonym for typename
@RogerPate what do you mean
@thecoshman It means these are identical: template <class T> and template <typename T>
template<typename T> is identical to template<class T>
but can you define a class using typename?
10:16 PM
@thecoshman Your room mate is wrong, there is no "overhead" to using a class or struct, they do the exact same thing.
however, in template<template<typename> class>, you cannot replace the class with typename
@thecoshman: you can't, 'class' is overloaded, like 'static'
@thecoshman No, this is w.r.t template parameters.
@JamesMcNellis That Boost.PP code is...pretty.
is there any way of proving to him that there is no over head... its one of those dambable things. not seeing jsut proves youve not seen it, not that its not there. once you see it, you have proof it is there
@thecoshman: compile to asm and compare
or read him the relevant sections of the standard
but you should still use struct to define your classes
@RogerPate but like I said, that would only prove that that case does not show overhead
@RogerPate Why use structs to define classes? surely this shouldn't matter?
10:20 PM
What's your logic behind that Roger
6 mins ago, by Roger Pate
because you can omit a public once in a while?
isn't that enough?
@RogerPate how does it though? I mean there is no difference is there in how you right a class and how your right a struct, just that one keyword
have you ever used TMP with 40 classes on 40 lines? :)
10:22 PM
taking two public tokens out of each line greatly helps there — and it never hurts even for a class definition spanning 400 lines
@RogerPate I'm almost inclined to agree with you, but that would be so very strange. How would you write this:

class foo
foo() : x() {}

int x;
in your style?
struct foo { foo() : x() {} private: int x; };
class for{ int x; public: foo(): x(){}};
class for? you are fired
10:25 PM
@RogerPate Hm, thought so. idk, that sort of private without a public feels weird. Obviously not an argument against, but I'd have a tough time getting used to it.
@CiscoIPPhone PLEASE tell me what is wrong with class? I honestly can't see why you sohuldn't use them
I was just being silly because your class is named 'for'
I'll consider using struct for sure.
@thecoshman There is no run-time difference between class and struct. Only syntactical differences.
I would love a solid reason to use one over the other, but so far the best I can see is purely a matter of taste. if its a relatively simple data object, use a struct
readability and consistency involve taste, but not purely so
10:26 PM
@CiscoIPPhone oh right :P
The usual idiom I've always seen is to use structs for POD and class in the other cases.
Er how about this for the variadic idea:

void foo(VARIADIC_PARAMETER) { ... }
(Dammit, why won't it go fixed-font?)
@RogerPate well, unless their is a performance reason to use one over the other it can oly be a matter of taste cant it?
@MatteoItalia: that's common, but when it's important, you have to be explicit about it anyway (e.g. in docs)
@thecoshman: do you indent your code? is there a performance reason? is it purely taste?
every sane c++ programmer agrees some indentation is better than none, even if they never agree on whether that should be spaces or tabs (it should be spaces)
@RogerPate there is not a executable performance increase, but there is definitely a performance increase in my code writing
10:29 PM
@thecoshman: and your productivity is far more important than runtime performance
@RogerPate phft, this is why use IDEs :P
why would you require an IDE for indentation? any half-assed editor handles that
@RogerPate a) if structs and class are the same, there the is the same runtime performance, its just down to how you want to write your code b) dose not using C++ create some over head compared to C just to make our lives a bit easier?
a) yes, and how you write your code involves taste, but not exclusively
@RogerPate: you're perfectly right, I was just saying that it's the most common usage pattern I've seen; since there's such redundancy in the language, IMHO it's clever to use it to convey some information to the reader of the code.
10:31 PM
b) no
@RogerPate sure IDEs do a lot more faf then needs to, but I am enjoying my faf
@RogerPate new ?
@thecoshman: what about it?
@RogerPate: that quote is not referred to this kind of stuff, and you know it.
10:34 PM
actually, it does
if you're reading the code and some clever trick with a keyword misleads you, that's bad
@RogerPate well my C vs C++ aint great, but does not new basically call C functions, but not as fast (potentialy) if done in C
@thecoshman: new allocates and initializes; this is most often combined in C as well: it's effectively the same thing
and if you want to allocate without initializing, you can do that in c++ too
ooh, fancy, but besides the point
@RogerPate How can such thing mislead you? It just suggests you that that type is primarily intended for "simple" data storage, that's it.
@thecoshman There is no difference in speed between languages, they're just languages. However, there is *potential* for differences, and often times people forget that.

That is to say, calling `malloc(sizeof(myclass))` and `new myclass` are *different*. One initializes, the other doesn't. So comparing them is a folly.
10:36 PM
@MatteoItalia: what does 'simple' mean? if it means pod when the type isn't, that will mislead you
@MatteoItalia I can sort of go with this
yes, people often forget that: you can only compare equivalent code
similar to the quote "if 'works' isn't a requirement, I can make my version fail faster than yours"
(about optimization)
@MatteoItalia: and if simple doesn't mean pod, is vector<int> simple enough? (if it's not, your definition of 'simple' is of no use to me)
@RogerPate Ok, before I expressed me badly; in my opinion, you should use structs when it's just for data storage/aggregation. In general, if you start to have methods/serious encapsulation you should go for a class.
There is no real reason though to not use classes for POD other then you would normally use a struct... which is a poor reason for anything
@thecoshman Say that again?
10:38 PM
@MatteoItalia out of convention that is?
@MatteoItalia: so it's only a vague general suggestion that's not always followed? why not just scrap it altogether, be consistent, and never think about that problem again?
@GMan If you want a bunch of data class, there is nothing /bad/ with that, but normally you would use a struct for such a thing
Just by convention. There's nothing inherently good or bad about either choice.
to be fair, c++ had no reason for struct, every thing you can do with struct can be done in class, but having struct still works just let C code be ported 'faster' (is find a replace newer then C++?)
C++ had a reason for struct: C compatibility
it's class that is redundant
10:41 PM
@thecoshman So couldn't you equally say C++ had no reason for class?
Roger is faster than me, I lose.
As said, for the compiler there's no difference at all. In the code I write, it just expresses the general idea that there's behind that type. It's a bunch of data? struct. It's more complicated stuff (manages files/resources/DB, has lots of methods, uses polymorphism, etc)? class.
We all agree that it's a redundancy. Since we have it, I just exploit it to provide the general "feel" of the type, at least I put it to some use.
(the follies of C-syntax compatibilty are another issue, but that's the choice that was made)
well yer sure, C++ could have just extended struct... which it basically has now
#define class struct
@thecoshman s/could/did
10:42 PM
though tbf, c++ gained a huge amount of popularity by remaining mostly c compatible
@RogerPate at a cost
legacy support is a dead leg
case in point, MS software
I completely agree, but decisions rarely make sense 20+ years later; especially when it was "let's have kids"
@RogerPate aint hindsight great
@MatteoItalia I just find no use in such vagaries and can't recommend them to any programmer
if it's a handle class, or a db class, or a smart pointer — name it appropriately, you get just as much of a general sense from a good name
10:45 PM
you guys aware of the site 'logging' how much combined time has been wasted on IE compatibility - think there should be a same for struct v class debate wasted my programming time
psh, it pales in comparison to tabs vs spaces
Braces go on the next line.
consolas vs wingdings
I vote for an EPIC #care conversion is not hard
10:47 PM
@GMan: you are evil and will burn in hell
+1 to the braces on new line party
actually, braces never bothered me much, as long as they are consistent
I used to prefer that style (called allman style), until ~5 years ago
that = new line
inconsistency is the source of evil!
10:48 PM
What happened 5 years ago?
He changed his code style.
an epic allman style debate?
someone finally showed me how much easier things are when you can see more on the screen :)
@StackedCrooked I keel you.
@RogerPate Eh, I say buy more screen. :P (Not really. I understand the argument.)
And dammit all the avatars going on and off the screen look like spiders from the corner of my eye, it's freaking me out.
I buy more screen too, but I fill it with more windows :)
10:50 PM
I almost mentioned that GMan.
I recently got my 27" iMac. And I must admit that it really helps.
It's disturbing
I still browse in about a 1000px wide window, even when I have triple widescreens
They should make them grow spider legs I think
10:50 PM
Is anyone here?
o hai
where is here?
Does anyone know what algorithm does string.find() on the STL use?
A good one.
10:51 PM
I am here, but here is not there. there is here for you, but for me there is there, and here is here
Is it the same than the find from the algorithm library?
@thecoshman, I'm reminded of that Beatles song now...
@Martin wouldn't it vary based on the STL implementation?
wikipedia has articles on the major substring search algorithms, if you're interested
@ZackMulgrew I guess so, but what is in the gcc implementation?
10:52 PM
iirc, all that's required is that it's no worse than O(n*m)
I have spent the last 6 hours programming... which actaully turns out to be a bout 50 lines and 5:50 of talking about programming
@StackedCrooked: me too... I am the Walrus :)
@StackedCrooked your welcom?
its O(n + m)
it uses a hash table for characters
10:53 PM
5 lines/minute is fast! you must use braces on a separate line
@RogerPate lol
@BobFincheimer So its pretty much the same complexity than Knuth-Morris-Pratt? Great, thanks!
Just wondering, anyone here went to IOI this year, or participated on the IPCP regional?
I always thought string::find was a simple linear search...
technically it is
it does a linear search
@StackedCrooked: as I said, I believe that's allowed
10:54 PM
@RogerPate how big is a line </hippy talk>
5 inch lines is all the coke you can snort in one breath
@RogerPate and yer, actually I do. and heafer files don't take much coding :P
@RogerPate wait... do we finally have an SI for the length of a line?
What's an SI?
as in, paying by the kLOC with bonuses for "finding" bugs is not a good idea...
10:57 PM
@StackedCrooked did I get that wrong, the standard unit bussiness...
I think he meant SI unit
Ah, I see.
[[Image:SI Brochure Cover.jpg|frame|right|Cover of brochure [http://www.bipm.org/en/publications/brochure/ The International System of Units].]] The International System of Units (abbreviated SI from the French ') is the modern form of the metric system and is generally a system of units of measurement devised around seven base units and the convenience of the number ten. It is the world's most widely used system of measurement, both in everyday commerce and in science.An extensive presentation of the SI units is maintained on line by [http://www.physics.nist.gov/cuu/Units/units.html NIST...
I thing the SI for line lengths is character.
I would love to be able to use "a snort of coke" as a measure in conversation. "I want to have a window fitted 10 snorts of coke wide please"
10:59 PM
yes, that is brilliant
first: what is the conversion from inches to snorts of coke
should it be 3 or 4 inches per snort?
@RogerPate I belive it is defined as 5"
that's what she said
I have a NSFW unit of length that my SO disproves of me using in convo... but I like to slip it in GIGADY!
this conversation took a turn for the worse
Yesterday I learned that vector<bool> is slow because it uses only a single bit per element.
11:02 PM
ironically, I do actually find it a useful unit of length... its funny how many things are of this length... when you walk around looking for them it is :P
I thought I knew all there is to know.
You learned how it's stupid and sucks.
It does, it turned out to be a bottleneck in my code.
@StackedCrooked you mean a vector<bool> 8 elements long is one byte?
11:03 PM
I suppose.
on one hand, that's clever that it does that for you... if you want it
I've been aware of that for a while, always thought it would be a good thing though.
@thecoshman Assuming CHAR_BIT is 8.
but its an easy fix, vector<char> or vector<int> plz
Yep I changed to vector char.
I was mostly surprised by the fact that I didn't know this.
I've been programming C++ for over 5 years now :)
11:06 PM
Dam you all! I was trying to work... but this being social business it funny some times
And I'm still often embarrassed to discover something I didn't know.
How did you realise it @StackedCrooked?
By asking a question on StackOverflow stackoverflow.com/questions/4006883/…
It was actually not related to vector<bool>
The person that answered my question just happened to spot it in my code and mentioned it.
@StackedCrooked Every day is a learning day
I shouldn't hang out on SO when I've had too much coffee; stackoverflow.com/questions/2082362/…
11:08 PM
I'm pretty much convinced my single-function variadic template idea is impossible. Also supported by the fact, afaik, it hasn't already been thought of.
vector<bool> doesn't meet the STL container requirements either
@RogerPate Good comments, though. :)
@RogerPate wait what?
I love chromes ability to resize text areas
yeah, I don't use it often, but it's invaluable
11:28 PM
I find it funny how even though recursion is explained to people, in some case with great effort to get them to understand it, most of the time it offers a really poor solution to the problem, in terms of speed any way
teaching recursion isn't about runtime performance
it's about teaching you how to think
I just like how even though its a cool idea, its not really that practical to use it
tough i suppose it can help understand a problem
I am sure there is some situations where it does provide a better solution
I count using parsing grammars, for example, among the many practical uses of recursion :)
and SO goes offline... chat too?
11:33 PM
it has gone dead fairly quickly aint it
I like how half the activity this room has seen this last 7 days is from to day alone :D
whilst it seems it may not be the done thing, Nigh all, got an ice cold bed to shiver in all night
sounds like fun
Obviously this isn't allowed: template <typename T> void foo(const T& = 0);. What's the closest thing?
As far as I can tell, it would be something like: class auto_parameter; that has a non-explicit templated constructor, which then dynamically allocates a class template instantiated with the constructor type internally, and operates on it through a base.
11:54 PM
T const &=T()
=0 is allowed, but 0 must be convertible to T
unless I misunderstood
do you just want to overload void foo() { foo(0); }?
My bad, I asked a bad question (for shame!). I meant to allow `T` to be deduced given other types.

aka what I'd really want is
struct none{}; template <typename T = none> void foo(const T& = T())
I still suck at formatting chat.
does 0x have default values for template parameters for functions?
just overload
Well this is to fake variadic templates, and avoid overloading. :)
But you just gave me an idea
variadic templates work by generating overloads through instantiations; you may not be able to avoid it
Yeah, that's what I was afraid of earlier when I was wondering if there was some sort of a priori reason it's not possible in 03.
