« first day (447 days earlier)      last day (4494 days later) » 

12:00 AM
I guess in your type-erased iterator that won't work because, well, it depends on the type that you're erasing :)
a->b may be transformed into a.operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->().operator->()->b
 
@RMartinhoFernandes yeah, since I couldn't return the underlying iterator, I went with microsoft's implementation of hoping &*iter is a pointer. Either way, it doesn't return itself, so no recursion.
@RMartinhoFernandes And I carefully designed it so iterators can be nested if the user really wants to, but I can't think of a use-case.
 
@MooingDuck How about addressof(*iter)?
 
@RMartinhoFernandes need an allocator for that.
 
Why?
There's std::addressof in C++11.
 
@RMartinhoFernandes waitwhat?
 
12:06 AM
That's the only surefire way of getting a pointer from a reference.
Because unary operator& is overloadable (which IMO, was a mistake).
 
@RMartinhoFernandes oh whoa. nice. Will do!
@RMartinhoFernandes Actually, that has the same problem. What if iterator::pointer is not value_type*?
 
@MooingDuck Your problem is more if iterator::reference is not value_type&, no?
*iter isn't required to return a reference, is it?
 
@RMartinhoFernandes the function is currently pointer operator->() const {return &*data;}, no reference there.
 
But *data is a reference. (Or so you hope).
 
@RMartinhoFernandes *iter is required to return a iterator_traits<iterator>::reference, so no biggie.
 
12:10 AM
@MooingDuck But is iterator_traits<iterator>::reference required to actually be a reference? That would forbid things like boost's counting iterator, no?
 
@RMartinhoFernandes no, it can be whatever. My code doesn't care. My code doesn't care about any of those, except that &*iter returns a pointer
 
@MooingDuck Yes, it does. You can't apply & on an rvalue.
If *iter doesn't return a reference, your code will apply & to an rvalue.
 
@RMartinhoFernandes ah curses. I'll have to template the thing. Oh well. What's two more classes?
 
@MooingDuck The only situation &*iter doesn't return a pointer is in the presence of overloaded operator&.
 
Surely that's rare? it seems stupid to me to overload that operator
 
12:13 AM
Yes, it's stupid, and thankfully it's also rare.
 
@Eloff: it happens for (rare, indeed) proxy classes
 
I never code thinking about it.
 
@RMartinhoFernandes if I make template specializations for operator-> then that solves all these problems. return iter.operator->() for everything, except return iter for pointers.
@sehe probably for std::reference_wrapper
 
@MooingDuck No.
It provides a conversion to T& and an overloaded operator(). Nothing else.
 
waitwhat? I have a function definition that's getting the error "too many initializers". Hrm...
oh, I had bool pred(l,r) instead of return pred(l, r);
 
12:33 AM
virtual inheritance makes objects a lot bigger :(
 
in general, if you have virtual inheritance, you're doing it wrong
 
@DeadMG I want so badly to point out a case where you're wrong, but the only placed I've ever used it was when making a wrapper for a poorly designed API. :(
 
heh
besides, you can't point out a single case where I'm wrong, because I only made a statement about in general
 
let's turn that around so no one can disagree....
If you have virtual inheritance in general, you're doing it wrong.
 
huh
can't reproduce my concurrent_queue problem anymore
 
12:40 AM
which thankfully is a much rarer problem than people who use virtual methods in general, because they think C++ is just a more annoying version of Java
 
wait... my code just fired an assert in a release build. I fixed the problem, but... shouldn't asserts be disabled in release? That'd explain why my code is so much slower than std::map then...
 
concurrent_queue problems tend not to be reproducible :-p
 
heh
it was a simple, obvious bug with a trivial repro
but I've discovered that my university machine and my home machine have two different implementations
the home one is bugged, and the university one is fine
 
gah, everytime I touch something my class goes slower and slower :( Now it's four times slower than std::map.
at least for lookups. I still seem to be faster for insertion. Which should be the other way around as well.
 
lol
what allocator are you using?
 
12:49 AM
@DeadMG default allocator
 
swap it for object pool<node<k, v>>
 
@DeadMG std::lower_bound is now running four times slower on std::vector than std::set::lower_bound is.
 
There's one in boost.
 
@DeadMG that would make the std::map even faster, and make me cry even more
 
Wait, you want to make it slow?
 
12:50 AM
@MooingDuck No, I mean, swap it in your code
 
@DeadMG my code uses a single sorted vector underneath, I don't see how an object pool is going to help lookups for that.
 
true
then how the hell is map looking up faster than you?
 
@DeadMG that's what I've been wondering all week
 
wait
you use a single sorted vector?
map is a red/black tree
they'll probably be faster
 
you expect a vector to be faster than rb tree? o_O
 
12:53 AM
@DeadMG yeah, when I tested with 8, 4-byte-PODs, I could do 24166417 lookups/sec in a map, and 18364660 lookups/sec in a sorted vector.
@Pubby sorted? for lookups? yes
 
no
 
@DeadMG how would a node based container be faster than a sorted vector for lookups?
 
because the nodes are pre-laid-out in the optimum arrangement
 
@DeadMG wait, what?
 
consider the case where the tree isn't of perfect size O(2^x) for some x
the r/b tree deals with this more seamlessly than the sorted vector
 
12:55 AM
How big is the vector?
 
also, the random-access nature of the vector won't help you much here
 
@RMartinhoFernandes I'm testing 8, 13, 32, 64, 128, 257, 1024, and 2000 elements, of 8, 16, 32 byte PODs. And std::string
 
if you can fit anything less than, say, 8 elements on a cache line, then the CPU may still end up loadng a new cache line for virtually every access
 
@MooingDuck If all or most of it doesn't fit on a cache line you won't get much benefit from that.
 
@DeadMG I don't see how the r/b tree deals with odd sizes better
@RMartinhoFernandes then at worst they should match, right?
 
12:57 AM
well I admit that I don't know an awful lot about R/B trees
however I think that simply, the vector isn't correctly balancing
if the size isn't exactly 2^x, then the "middle" element might not actually be the "middle" at all
 
@DeadMG Er, why not?
 
@DeadMG it can only be off by 1 in a vector, for a R/B tree it can be off by... several
 
@RMartinhoFernandes Because in an R/B tree, you can have 2 elements to one side of the middle and 1 element to the other side, for example
but the tree algorithm doesn't actually care
 
With the vector you always divide the search space by 2 in each iteration (modulo oddness).
 
whereas in a vector, if you simply started at size/2, it might not actually be the middle value
 
1:00 AM
@DeadMG Please show an example.
 
@DeadMG yeah, size/2 is always the middle, plus or minus half an element.
 
The element at size/2 in a sorted vector is the median (again, modulo oddness).
 
the plus or minus is the problem
 
It has as much elements smaller as it has larger.
By definition.
Because it's at the middle.
 
if you have an even-sized tree, then you might plus when you should minus
 
1:01 AM
@DeadMG whereas the root of an RBTree can be off by as much as 1/6th of the data (in the worst case)
 
For reasons I can't fathom, it looks like the vector beats the map hands down for PODs over 16 bytes
 
the r/b tree has a clearly defined proper root, but the vector's size/2 is ambiguous, because there's an even number of elements
 
@DeadMG at most the vector will have one extra element access more than optimal. A map can have a most double.
 
1:03 AM
so if your implementation decided to go +1 in that case, and in the example you should have gone -1, then you won't get the correct results
 
@DeadMG Of course it will get the correct results.
 
@DeadMG an RBTree is even worse
 
It's not buggy.
A binary search won't ever look in the wrong branch.
 
Why doesn't Duck just show his code?
 
@Pubby oh, I could do that :(
I don't have a minimal example though. I tried but in the example the vector was faster :(
GCC/IDEOne doesn't seem to like my code
but it's at ideone.com/aMQve for the moment. I'll try to get IDEOne to compile it.
 
1:09 AM
Also, won't the shape of the tree depend on insertion order ?
How does that make the tree more suitably balanced?
 
whoa, now I'm trying to figure out how MSVC made vector<stuff> == map<stuff> compile.
 
@MooingDuck are you doing binary search? Or linear?
 
@Pubby binary
@RMartinhoFernandes I had assert(a == b) where a was a vector and b was a map and it compiled in MSVC
 
NDEBUG?
Asserts are completely vaporized if NDEBUG is defined.
 
1:13 AM
@RMartinhoFernandes oh right, I added that in, and never tested debug. Good call.
@Pubby std::lower_bound to be specific
ideone.com/2Bb7p wooo! SIGSEV!
 
Ha! So it's buggy!
 
MSVC10 seems to run it fine. Hrm.
 
You know how UB is :)
 
though I was surprised at how few bugs I'd found so far.
 
Sigh. I doubt std::ifstream i("F:/Code/Contests/About53/2000words.txt"); will work on ideone.
 
1:17 AM
@RMartinhoFernandes facepalm
 
When preceded by the appropriate ln -s incantations, I believe that path can indeed be made to work. Although one likely hasn't permission to do so on ideone.
 
@RMartinhoFernandes easy enough to fix, I'll just remove the string test. ideone.com/BKWf9
 
and why are you comparing vector and map performance without considering Judy?
 
@BenVoigt never heard of it
 
Well, it sounds like you're trying to reinvent it, badly, so have a read.
 
1:28 AM
man
I can't even have fun watching porn
@BenVoigt "Judy is a C library"
stopped reading
 
@DeadMG ouch
 
the design documents are still well worth reading, even if the code sadly lacks the keyword template.
 
@BenVoigt got it to compile and run all tests ideone.com/G9ZNs except the string test
 
@BenVoigt The design is likely completely invalided by the keyword template
 
gaH! I'm late again!
 
1:30 AM
@DeadMG: Since I've read the design before, and you don't care to, I promise that there are a TON of ideas in there that are applicable to writing a fast associative array in C++.
@DeadMG Things you pointed out like this, already accounted for and optimized
But all the explanation is still with the C version.
 
so, basically, it's a bitwise trie
impressive, but hardly a revolution
and look at the key and value type restriction given in that C++ version you linked- only integral or pointer types
not really OK if you can't store things like shared_ptr
 
I thought when it said "data type: any" in 2 out of 3 columns, that meant support for shared_ptr...
and considerably better cache behavior than a naive trie
 
1:47 AM
Does this look like Obj-C room?
 
2:06 AM
@DeadMG i thought tries were about compressing search trees. i don't think storing (smart) pointers in there would really be a prime area of application? Haven't looked at the link yet, though
 
@Nathan C++ != ObjC.
Installing VS2010 SP1 is such a pain.
 
@EtiennedeMartel I hear you
 
Isn't it just click & wait?
 
Yeah. But it takes about a year.
 
The click is pain
And the wait is a lot of the same
 
2:14 AM
Plus you can't cancel it.
But I think it's almost done.
0
Q: Why is term not evaluating to a function taking 0 arguments?

MehrdadWhen I try compiling template<bool val> struct boolean { static const bool value = val; }; template<typename T> struct is_callable : boolean<sizeof((*(T*)0)()) >= 0> { }; // error! int main(void) { bool b = is_callable<int()>::value; } I get: error C206...

 
2:57 AM
What kind of a game show is this? Category Pokémon? WTF?
 
 
Pretty stupid question actually, who's to say kettles can't be a parsec in diameter?
 
Maybe such a big kettle would collapse under its own weight or something.
 
Perhaps our universe was created after such a kettle-collapsing event.
 
3:14 AM
> The Adobe Flash plugin has crashed.
Fucking Flash can't even handle YouTube.
 
3:27 AM
"Prior to the invention of the linked-list..."
Very strange to read that and realize how taken-for-granted lists are
 
Nonsense. Everyone knows linked lists just popped into existence by the fifth day.
2
 
3:43 AM
Data structures aren't invented, they're discovered.
 
is there a way to hook onto the system so that whatever app your in the process will stay true?
so like if i write fome objective c for mac, how would i make it so that if i click on a diffrent app, the in app effects would apply to that app, or hook the code to that app being open, it could just be the code aplying to one app
 
Are you sure you're in the right room?
 
its c
a variation
plus this is the only room open with a few peeps
 
Xeo
That doesn't mean you can come in here and dump unrelated questions just because there are some users in here.
 
C, C++, and Objective-C are very different languages, even if they share common ancestry and syntax.
 
4:01 AM
@Xeo, y are you so harsh, this is a community, say it nicer and i will take your point into consideration
 
Xeo
Woot, I got a flag. D'aww, it's gone already. :(
@TrevorRudolph That was not harsh, that was simply stating a fact.
 
in a harsh manor
 
Beauty is in the eye of the beholder.
 
Trevor, you've been told you're off-topic. Now, you can argue about it, or you can spend your time productively looking for solutions.
Besides, your question has nothing to do with ANY language, it's got everything to do with the platform itself.
 
4:18 AM
All languages with letter 'c' in the name are the same as C!
It's so obvious!
 
Like WideC!
 
Xeo
@CatPlusPlus Cobol, javasCript, bra*nfuCk, ...
 
ABC, COBOL, Common Lisp, BASIC.
 
Xeo
All the same!
 
ColdFusion.
 
4:20 AM
But Java is different.
 
OCaml
 
@CatPlusPlus Gosh, why did you mention that abomination?
 
Xeo
Anyways, off to sleep. g'night
 
Factor, obviously, too.
 
What is wrong with OCaml? (I don't know a thing about it)
 
4:30 AM
He was replying to "ColdFusion".
 
The abomination I referred was ColdFusion.
 
Oh, never mind then.
 
And the list of things wrong with it start with XML.
 
4:46 AM
I've been working on a new OS and was wondering where to start with user-mode libraries (as in standard APIs for user-mode applications). I've finished most of the kernel-mode logic, and can get the computer to boot into a basic BASH-style interface, and have also created a basic filesystem.
 
I was just looking at alphabetical list of languages.
 
Where do OS developers usually start in terms of user-mode libraries?
 
What user-mode libraries?
You need libc as a start, most likely.
 
OK
I'll start implementing that
Thanks!
 
You don't want to implement libc by hand.
 
4:48 AM
do you have syscalls working?
 
You want to port glibc or newlibc.
 
Yes; with basic opcodes
 
Well, or uclibc.
 
wire up one of the simpler libc implementations to those syscalls
 
I think newlibc is quite dead these days.
Though it was one of the easiest to port.
 
4:49 AM
and you should then get most of the functions for free
 
Wow. libc is one complex library
 
No shit.
Ugh, my stomach vetoed on my choice of food. It is suck. :.
 
I'll be working on this one for a while :)
 
You really don't want to be implementing it from scratch.
 
4:51 AM
I can see why.
 
@CatPlusPlus Would be so much nicer if it could do so before you ingested said food, wouldn't it?
 
@RMartinhoFernandes Yeah.
 
Think I have a working implementation of malloc now in user-mode....
 
Ugh. Do you overload operator>> for both std::istream& and std::istream&&?
 
Nope.
 
5:01 AM
So no std::stringstream("blah") >> x?
 
I don't find it very useful.
 
Perhaps in my new OS I should re-write all the libraries to use hiv:: instead of std::
 
Oh wait, I don't need to.
template <class charT, class traits, class T>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>&& is, T& x);
This is in the standard library.
Neat.
@IDWMaster You do know that would basically make any C++ program not portable to it, right?
 
@RMartinhoFernandes It was a joke obviously.
Even if I did make it hiv instead of std; it would still be simple to write a script to replace all instances of std with hiv. Today's IDEs are pretty powerful
 
Yeah, then get that wrong because of a macro somewhere.
As powerful as IDEs are, automated refactoring on a C++ program is not trivial. Visual Studio can't handle it, for example.
 
user406009
5:11 AM
You could define an alias _Hiv that just pointed to std
 
user406009
Then declare std deprecated.
 
The possibilities are endless!
 
Xeo
@IDWMaster I know another possibility: don't. :)
 
not even needed. just namespace std { using namespace hiv; }
 
Safer with a reserved name.
 
user406009
5:25 AM
I think a better idea for your OS would be for it to automatically rickroll anyone who causes a segfault, and to play the Friday song whenever anyone divides by zero.
 
user406009
Should make bug finding more fun.
 
Anyone know the answer to this?
8
Q: What's the opposite of "concatenate"?

tajmoTo concatenate means to string together different things. Concatenating "snow" and "ball" produces "snowball." But what would the opposite action be? What is the name of the action used to derive two words from one? (My dictionaries don't list any antonyms, and Googling revealed how to do the op...

 
That sort of feature might have to wait until flash player is stable. Oh snap, that might never happen. Maybe at least stable enough.
"split"?
 
2 hours ago, by R. Martinho Fernandes
Fucking Flash can't even handle YouTube.
 
In grammar especially, "stem".
and the answers already mentioned both of those
@Pubby, why'd you link a question that already has answers?
 
5:30 AM
Yeah, but neither seem correct
Split sounds like the opposite of join, not concatenate
 
What about decatenate?
 
join IS a concatenation
It just concatenates the inputs and separators
In the general case, concatenation loses information (where the separations lie) and that information cannot be perfectly recovered in the absence of additional information.
 
Join is a relational algebra operation.
Not sure how relevant that is (probably not at all), just came to mind.
 
It's also a list operation.
 
concatenate is a sequence operation
I think (don't know much math)
 
5:33 AM
I'm naturally afraid of links to Perl documentation.
 
why?
 
How is Perl relevant to english language?
 
If you can handle C++, you can handle Perl.
 
Reminds of $ perldoc perlvar.
 
perldoc perllol is worse, IIRC
 
user406009
5:34 AM
I don't know why so many people complain about C++. If anything, it makes more sense than Java.
 
@BenVoigt Now I'm too tempted to not investigate that. If I get brain damage, I'm blaming you.
 
Ethan, it does make more sense, but there are also many many many more rules to deal with.
 
@BenVoigt Ah! References. My favourite Perl feature.
 
What about member access on references inside quoted strings?
 
6:34 AM
@RMartinhoFernandes
@RMartinhoFernandes Hello Martinho , mind helping me with a file reading quandry ?
 
Hi.
What's the problem?
 
Hey :) I'm reading this text file into a buffer and while there is no vertical tab (ascii 13) everything works great , but when there is a vertical tab in the file , for some reason , getline inserts a '0' into my character buffer , any idea why that is ? or what that '0' is for ?
 
A vertical tab is ASCII 11 (0x0B).
Oh, that's 13 in octal.
@angryInsomniac Do you mean a zero as in, ASCII 48 (0x30), or a zero as in a NUL character? (ASCII 0)?
 
@RMartinhoFernandes I'll tell you the last two entries in my array
13 ''
0
there is no character after the 0
its just a 0
 
Elephant woman is hilarious.
 
6:44 AM
Vertical tab is a line terminator.
 
The expression on her face.
 
That's why it ends the string.
 
@RMartinhoFernandes and yeah , I was wrong it was 13 decimal , that means Carriage return , not vertical tab'
 
Well, that's also a line terminator.
 
@RMartinhoFernandes What I dont understand is , why the 0 ?
 
6:46 AM
@angryInsomniac Because it's a null-terminated string.
 
@RMartinhoFernandes arent those characters ignored while reading ? (apparently not , but I seem to remember reading something that said so)
 
Which characters? NUL?
 
@RMartinhoFernandes and ... isnt the NUL character '\0' ?
 
Yes.
C strings are always terminated with a '\0'.
'\0' == 0
 
@RMartinhoFernandes Hmm , ok , starting to make sense, will read more on this :) thanks for the help
 
6:50 AM
'\0' != '0' and 0 != '0'. Was this your confusion?
 
@RMartinhoFernandes Kinda ... I was just surprised to see a phantom character appear out of nowhere !
 
To handle strings you need to somehow know where they end.
In C that's done with a 0 as a marker in the end.
 
Which is an endless source of fun.
 
Pascal, for example, did so by prefixing them with the size.
 
@RMartinhoFernandes Yeah ... now I remember the whole deal with NUL terminated strings and size prefixed ones :)
 
6:58 AM
Does unicode (utf-16,32) use Pascal strings?
Or is the length stored separately?
 
Unicode doesnt care
UTF-16 is a character encoding, not a string class
 
7:12 AM
Laura Dekker (born 20 September 1995) is a Dutch sailor. In 2009, she announced her plan to become the youngest person to circumnavigate the globe single-handed. A Dutch court stepped in, due to the objections of the local authorities, and prevented Dekker from departing while under shared custody of both her parents. In July 2010, a Dutch family court ended this custody arrangement, and the record breaking attempt finally began on 21 August 2010. Family Dekker was born in the city of Whangarei, New Zealand during a seven-year trip by her parents. Her father, Dick Dekker, is Dutch and he...
Starting to gain respect for this person.
I thought the whole attempt was silly, but she's actually pulling it off.
 
That's really retarded.
 
hi
 
7:28 AM
> Yo dawg we heard you like recreating accidental suicides so we put a suicide in your recreated accidental suicide.
 
Nice
 
8:14 AM
 
8:25 AM
morning all
 
Thursday October Christian (14 October 1790 – 21 April 1831) was the first son of Fletcher Christian (leader of the historical mutiny on the Bounty) and his Tahitian wife Mauatua. He was conceived on Tahiti, and was the first child born on the Pitcairn Islands after the mutineers took refuge on the island. Born on a Thursday in October, he was given his unusual name because Fletcher Christian wanted his son to have "no name that will remind me of England." Thursday married into his parents' generation. At age 16 he married Teraura (Susannah), who had been Ned Young’s original , and was p...
Awesome name.
 
@thecoshman looking back at this, I feel so stupid
 
> Pipon refers to him as "Friday October Christian," because they had discovered that the islanders' calendar was off by one day.
lol
 
sbi
8:41 AM
@RMartinhoFernandes Don't you know Thursday Next, daughter of Wednesday Next?
 
@sbi But Thursday October is not a fictional character.
 
sbi
@RMartinhoFernandes There's that, yes.
But really, haven't you read Fforde yet?
 
sbi
@RMartinhoFernandes Now there's something you have missed out! If you like Pratchett, you will love Fforde's Thursday Next and Jack Sprat series!
@AlfPSteinbach This is giving a whole new meaning to the term "food porn". And not a nice one.
 
I'll keep an eye out for it.
 
8:45 AM
@sbi you didn't like it?
 
8:58 AM
Good morning
 

« first day (447 days earlier)      last day (4494 days later) »