« first day (265 days earlier)      last day (4684 days later) » 

7:57 AM
Good morning.
 
8:45 AM
morning
I'm still looking for a good explanation of an algorithm which produces all possible permutations of a string, with distinct characters first
Just found recursive solutions, but want an iterative.
The idea is to just choose one character place it everywhere possible and leave the rest of the string unchanged. For each of the string generated this way do it with each character again.
 
@KerrekSB Hi!
 
Hi!
Not really, but I'll scrape off a minute or two :-)
'Sup?
 
With just a bit of modification your answer can fully satisfy the OP requirements
 
You mean general subsets?
 
No, subset in order
 
8:50 AM
X, A1, A2, X, X, A3, X ?
 
Yep
 
Wow
What's the idea?
More specializations?
 
Keep the same base case (false) and the same solution (i.e. <std::tuple<>, anything>)
Yes
Then use those two specializations:
<tuple<Same, ARest...>, tuple<Same, BRest...>>: <tuple<ARest..., BRest...>
<tuple<ADifferent, ARest...>, tuple<BDifferent, BRest...>>: <tuple<ARest..., BDifferent, BRest...>
Isn't recursion fun :)?
@KerrekSB I suggest the name ordered_subset
You might want to make the base template template<typename Left, typename Right> struct ordered_subset: ..., too.
i.e. no need for variadic args here
 
Wait wait -- in the second specailisation, what's the base class?
Should have two tuples
No never mind
 
In the first as well
Got it wrong
 
8:56 AM
sorry
 
<tuple<ARest...>, tuple<BRest...>> and <tuple<ARest...>, tuple<BDifferent, BRest...>>
 
Oh - wait, I'm struggling with angled brackets. Should have #defined something like TEMPLATE_PARAM_LIST_END or something readable
 
I usually indent to make things clearer
Do you want me to edit your answer?
 
Yes, sure!
 
In progress
 
8:58 AM
Did you check that it works?
 
Hang on then
I'm just confirming
 
I am writing the edit but will not commit before we're sure
 
Getting some errors at the moment
"ambiguous instantiation"
Foo<Apple, Orange>::bar<Grape, Apple, Grape, Orange, Grape>();
 
I'll test when I'm done writing but it's probably possible to avoid ambiguous instantiations via SFINAE
 
9:04 AM
I'm OK with the first specialisation. But in the second, what's the purpose of ADifferent?
AIINAE
 
ADifferent and BDifferent are supposed to not be the same (the other spec should be picked)
 
Ah wait, if I get rid of my original spec, then it's fine!
 
This is doing it the wrong way around isn't it?
 
Hmm.. but why do we allow different A?
 
It should be BDifferent that is discarded
 
9:06 AM
Don't all members of A have to match?
 
if we want to check that Left <= Right
 
Yep
 
Works for me
Only get an assertion on the one line that should
Commenting it out compiles fine
 
Now Foo<Apple, Orange>::bar<Orange, Grape>(); also matches, though
 
It fails for me
 
9:13 AM
OK, can you post your code?
Weird
Seems to me like ADifferent should be allowed to discard elements from A, non?
 
Feel free to comment out/add some lines inside main
 
Ohh
I had casually changed the order of the template params in the partial spec!
 
Ouch :)
 
I said template <ADiff, BDiff, ARest..., BRest...>,
 
That shouldn't matter
 
9:15 AM
But only ADiff, ARest..., BDiff, BRest... works!
Yeah!
Weird, eh?
 
Possibly a compiler bug
Can you reproduce on ideone?
I can't
 
Oh
No, sorry, that wasn't it
I got the base class wrong - I had <ARest>, <BDiff, Brest>
OK. Now it works
 
Should I proceed with the edit?
Ah! you did
 
great!!
Hm. Your code looks nicer
 
I can edit for indentation/style if you want
 
9:21 AM
Why don't you post it as an answer, then you can get the accept.
 
Nah
One answer is enough
 
Yeah, sure, you have a good way of styling this kind of stuff
I recommend #define TEMPL_PARAM_OPEN < for clarity
 
I don't O_O
@Kerrek Does it look Ok to you?
 
Yeah, great!
Thanks! OK, really got to go -- minute's up! :-)
 
Cya
 
9:29 AM
Bye!
 
 
3 hours later…
12:11 PM
hi
 
Hi
This room has been dead all day long.
 
I'm sure that my arrival will not change that
 
12:32 PM
cool, got to do some profiling at work
was able to show that their homebrewed string class is 2-3 times slower than std::string :)
 
lol
SSO ftw
 
12:50 PM
SSO?
 
1:00 PM
Hello everyone.
 
@wilx small string optimization
 
most strings are under, is it six characters? in length
so SSO is storing six characters in the string class, not on the heap
 
@jalf so i convinced one of my friends we need descent, he may buy it now
 
 
1 hour later…
2:35 PM
@DeadMG I'm not really sure if I understand something in your latest post.
> So far, I've decided to have a hash mechanism, where I will hash the arguments and use a thread-safe cache to ensure memoization of "pure" functions. This would effectively mean that for all the calls to std::containers::vector()(int), there is only ever actually one call.
Do you mean to memoize a vector lookup? I can't imagine that being faster than an normal lookup.
 
@Collecter that's a good trick. Getting your friends to buy all the expensive games :D
 
@jalf yep :D i said if he did i would buy roborally
 
@DeadMG actually, as far as I coudl se, it wasn't even SSO that made the difference. We saw about the same perf difference on longer strings. I didn't look into exactly what caused the difference, the goal for now was just to check if there was room for optimization in their in-house string class
which there was
@Collecter ah, handy
 
@jalf So, they're optimizing their string class? Why not just switch back to std::string?
 
@MartinhoFernandes it would not be as fun
 
2:39 PM
@MartinhoFernandes not sure which path we're taking yet. We just wanted to see if their string handling could be done more efficiently
and the problem is that their string class has a somewhat different interface, and is used all over the place in a pretty big and old code base
so it'd be a fair bit of work to just tear it out
 
not a simple matter of find replace all then?
 
one option we might look at is to rip out the internals of their string class, and make it use a std::string internally instead
 
If the code to adapt the interface is not convoluted.
 
@MartinhoFernandes also, it's not "back" to std::string. They've never used it until now ;)
 
Was string in the stdlib in pre-standard times?
 
2:43 PM
I wonder if their class was more efficient when it was written
*not class
 
Wait, it doesn't make sense to talk about the standard library in pre- standard times, does it?
 
*wait yes class
 
@MartinhoFernandes depends on when you mean. I'm pretty sure it was in a week before the standardization. But 8 years earlier? Or 20? ;)
@Collecter don't think so. But it seems to be fairly old, so they were probably comparing it against const char* mainly, and maybe against some early not-very-robust-or-optimized std::string
 
So, in the beginning, all you guys had was libc and C++ syntax?
Sounds fun!
 
@jalf for now wouldn't it be most efficient to replace their string class' internals with std::string, and then explore other options if needed?
 
2:48 PM
@Collecter yeah, probably. Only problem is that the team responsible for such general library changes (me and two others) are fairly busy for the next couple of weeks
 
@jalf i see. if you have been using this old string library for years, it should be fine for the next few weeks though. unless you guys need the optimization right now?
 
@StackedCrooked: No, it means to only instantiate the result type once
and it's not about speed, it's about making sure that std::vector<int> == std::vector<int>
 
@Collecter yeah, it's no rush really. They just noticed some performance problems in a new module being developed, so we took a quick look at what might be done
 
@DeadMG You know, hash(x) == hash(x) does not imply x == x.
 
@jalf I wonder how much more legacy code they have that code be improved with the standard library
 
2:52 PM
@Collecter Most of it ;)
 
@Martinho: That's what operator== is for
although you're right
 
@jalf I think i would enjoy making those optimizations
 
I was going to hash all the arguments together into one string, then hash it again and then use that as the key into the LUT
but, you're right that that isn't actually viable
 
@Collecter yeah, me too. So it's kind of a shame I'm leaving at the end of the month ;)
 
@jalf why are you leaving? Found a better job?
 
2:53 PM
definitely leaning more and more towards just using a lock
thing is, I'd need something like
 
@Collecter yep. Much closer to where I live, pays better, and sounds really interesting too
 
unordered_map<argty1, unordered_map<argty2, unordered_map<argty3, ...
 
I am going to ask this here on the offchance someone might know. Does anyone have any experience with spring in java? My boss threw a bunch of files at me and left. I have to figure out the URL mapping.
@jalf that sounds like a triple win
Something non C++ is mentioned and the whole board dies
 
It depends. Try mention that one that starts and ends with P.
 
@Collecter: It's way more common for us to discuss random shit in here than C++
but other languages, especially other worse languages like Java, usually result in either flamewars or being ignored
 
3:00 PM
@DeadMG I have noticed, and it is not my choice to use java here.
 
@MartinhoFernandes pex?
 
@MartinhoFernandes PHP!
 
Pex is cool.
 
lol
 
@jalf How does "pex" ends with "p" ?
 
3:02 PM
I got this internship hoping to go on back end, got stuck on front end. -.-
 
lol
 
Still better than my other option, which I did last year. I worked 4 days out of 8 weeks. I tried to work more but they had nothing for me to do.
(was getting paid the whole 8 weeks, but sitting there without internet was not fun)
 
@Collecter Without Internet? Where were you working? A torture chamber?
 
@MartinhoFernandes I was working for TARDEC. Most unoragized place I have seen. Took them a few weeks to get my laptop. Then they need to ship it to virginia (i live in michigan) to install a piece of software. Then to hook it into their database the guy who had the clearances wasnt around until the last week i was there. It was terrible -.-
 
by the way
which genius was it that suggested that I link to my blog from my SO profile?
 
3:15 PM
I did.
 
apparently, I've gotten 13 views from there, with 3 from the chat, and 1 from some random search site
 
Yes, I'm a genius. I know.
 
Add one more view. I just looked
 
I'm actually trending up to nearly a whole ten views a day
sick readership
 
@DeadMG I searched "thenewoldthing" on blogspot the other day, but all I found was some chick's fashion blog.
 
3:19 PM
curious
 
@kbok Is she hot?
 
I have one whole hit over like, three weeks, from that search
hahaha
question of the week
 
@MartinhoFernandes Well, I can only guess, there's no photos of her.
 
@DeadMG I get something like 12-15 on average
 
During school time, I get about 40-50 per day.
 
3:27 PM
views on your blog?
 
That's mainly because I posted my solutions of several class exercises with accompanying explanations.
 
lol
 
@DeadMG yep
 
@MartinhoFernandes That's what I should have done too
 
Well, not the one linked in my profile. That one is pretty much dead. It's another one I write in Portuguese.
 
3:35 PM
I figure
I'd be better off walking to MacDonalds every day and eating one than not
 
How's that good?
Wait, you eat whole McDonalds?
 
well
 
And they rebuild it every day
 
firstly, I'm way, way under the calorie count for a day's food
I'm at only 1300
and secondly, I could seriously use the exercise
 
How do you measure that?
 
3:38 PM
measure what?
 
Your calorie thingy.
Sounds like a useful trick.
 
well
you take what you eat and then you look on the packet to see how many calories are in it
if you eat stuff that isn't packaged, then you google it to see how many calories are in it
 
What, counting? But I don't want to deal with numbers! (Says the math major.)
 
lol
ok, I have a slight problem
 
To be fair, I rarely see a number used as a number in my math classes anymore.
 
3:45 PM
my washing machine has a habit of breaking down, so I've been trying to go as long as I can before washing my clothes
but I think I might have over-done it a bit, cause some of them aren't coming back out clean
 
@DeadMG Now I feel stupid. I thought there was some special apparatus or something.
:(
 
@Martinho: There is, but at least in this country, the food manufacturer does it for you
and my flatmate has used all my washing tablets
 
4:01 PM
yay, another pound lost
only another fifty odd to go before my ideal weight
 
4:38 PM
I don't ever lose weight.... my body shape changes but weight stays the same.
 
It would be almost impossible for me to lose weight. I am under weight for my height.
 
@Poik dumb math uses numbers. Smart math abstracts and reduces until it has an input/output method and then inputs the numbers.
 
4:51 PM
@MartinhoFernandes We do refer to libraries that come with implementations as standard, even in non-standardised languages, though. :P
 
> These are not bugs in STL, but in the way another programmer called it incorrectly, or possibly the STL is just there hanging around the actual bug which is in regular C++.
Hah.
 
@MartinhoFernandes Coincidentally, poop starts and ends with 'p'.
2
 
@CatPlusPlus it is also a palindrome
 
my puppy is cuteses
 
pop
 
5:07 PM
peep
 
pap
poodle el doop
 
it would be a lot sweeter if the word for palindrome was a palindrome
 
pup
 
Poopindrome.
 
bile pat tape lib
 
5:11 PM
@Collecter That would make palindrome an autological word.
 
@and that would make it great
i always forget to repsond to the person
just type @ thinking it knows what i am thinking
 
too flare bile pat tape liberal foot
A new version of scrabble where you have to add to the palindrome
 
that would be fun
 
or you can edit
 
Press up to edit last message.
 
5:15 PM
I am still in the habit of not being able to edit
 
habits are deadly
 
I am still in the habit of being able to edit everything.
 
yes hobbits are
 
Including other people's posts.
Other chats suck now.
 
I said something, but it didn't come out right.... but I can edit it now
I never have to make a new post again
This is fun
oh noes... edit timer... stupid SO chat
 
5:19 PM
Poor sod. He doesn't have a time machine.
How retrograde.
 
shakes head in pity
 
I have a time machine.... it got stuck in an infinite loop
The first time I used it, I went back in time and some unseen voice said, "Aha, there you are Adam"
So I am my own great.... great... grandpa
 
If I had a time machine, the first trip I'd take would be forward, not back in time.
Back in time sucks.
 
@Xaade Oh, you're all italics. When you've been assimilated?
 
True.... technology gets worse when you back in time.
 
5:22 PM
imagine going back in time and bringing modern tech back and having them analyze and build some lower level stuff
computers in the 1700s or earlier, all algorithms attributed to you
 
Or just smash your head with a club.
 
would also make now better
 
Too far back and you join in the salem witch trials.
 
or worse
dont go to salem, problem solved
 
I have this device which records a person's soul.... in a repeatable image... where they are doomed to make the same mistake over and over..... we call it.......................... youtube.
 
5:24 PM
 
@CatPlusPlus i will take all that credit. In fact I already have. why do you think everyone had a huge beard? It is to hide my face
 
What for?
It's kinda pointless to do that.
 
@Xaade I know. My favorite classes are the most abstract ones. Also, I probably shouldn't respond to something that was so long ago.
 
No problem. @sbi does that all the time.
 
@MartinhoFernandes Because I could really.
 
5:28 PM
Yeah, but meanwhile (for an appropriate definition of meanwhile), you could be living a great life in the future (for an appropriate definition of future).
Because, you know, to take all that credit, you need to learn all that.
You can't just come out and say E = mc^2.
 
@Poik 40 minutes is hardly long ago.
We sometimes respond to each other with a day apart.
 
Really, I judge long ago by number of posts in-between. And I'm used to the unused Java chat.
 
Yay for notifications across sessions.
 
@MartinhoFernandes Just print the papers out and bring them back in time with you, because you already did so anyway. In fact not doing so would collapse space time.
 
@Poik Did you @SuppressWarnings about unused stuff?
Gah, I make so much typos.
Good thing I still notice them.
 
5:34 PM
Umm... No?
 
Anyway, you can't really take credit long before the guy who took it. No one would understand you.
And your printed papers would be incomprehensible garbage.
 
Also, I missed that joke entirely. I'm an idiot.
 
Mathematical and scientific notation changed a lot throughout history.
 
yes it has. If I really wanted to I could try to do it throughout history. But yes it would be difficult
thought question
If i was 30, and went back in time and gave myself at every birthday a time machine, would there be multiple me's running around through space time? If so would it be the same timeline/world or multiple ones?
 
5:53 PM
Say I have a bunch of code for all controls, yet I need subclasses that interact with my software suite to use those common methods. I really want my subclass to derive from the control, not the class with the common code. (A MyEdit should derive from Edit, not from MyControl). Also, the suite interacts with controls using an interface which MyControl derives from. In order to do this in C++, I would use multi-inheritance like so class MyEdit : public Edit, public MyControl.
However, I suddenly discover that I shouldn't use multi-inheritance if I want some controls to be in another language which doesn't support multi-inhertiance.
Does this work???? MyEdit : public MyControl<Edit>; MyControl<Type> : public IControl;
Convert the common control stuff into a template, and give it the type of control I want to derive from.
Hmm... ok... that went on more than I thought.
 
0
Q: Change multiple inheritance into deriving from a template

XaadeSay I have a bunch of code for all controls, yet I need subclasses that interact with my software suite to use those common methods. I really want my subclass to derive from the control, not the class with the common code. (A MyEdit should derive from Edit, not from MyControl). Also, the suite in...

 
sometimes it's annoying when one answers a question and people ask and ask and ask without reading documentation
 
Tried looking for something to read.... couldn't find anything covering what I want to do....
Only thing I found similar was deriving from multiple interfaces in C++...
And the only template experience I have is with containers.
 
6:39 PM
@Collecter That would mean violating the first law of thermodynamics.
Thought experiments based on that tend to derail pretty fast.
Because if, instead of sending yourself back, you sent some power source, and you ended up with multiple copies of it, you could generate as much power as you wanted.
If you end up in some kind of "parallel universe", what about the "you" from that universe?
 
How would it violate the first law of thermodynamics? Wouldn't energy just be transfered by the time travel?
 
The total energy at your destination time would have effectively increased.
 
that would be assuming that the two points of space time were not connected. in order to time travel, the points would have to be connected, and energy would flow through that connection
to do otherwise would violate the laws of thermo
 
If you do that the total energy in the universe does not remain the same.
There's a spike up at your destination time and a spike down at your source time.
 
the connection does work both ways you know
 
6:49 PM
You also break the second.
 
let me re look up the laws, been a while since i used them
 
The second states that you cannot decrease the amount of entropy.
The first is basically the usual conversation law.
 
Now how would time travel make things less random? If anything I think it would increase the chaos
 
What about your source time?
Your removing your entropy from it.
 
Wouldn't the entropy stay the same as energy flows in from the "past"
 
6:51 PM
In fact, the second is the only law in the current physics framework that requires time to flow "forward".
 
You're assuming that the dimension of space is not a part of the universe.
 
Laws of thermodynamics eh.
 
@Poik Martinho or i?
 
My apologies, Martinho.
If time is a part of this universe, then energy leaving one time and entering another never leaves said universe.
 
7:25 PM
Oh crud. I said space, not time. Shows how much I was paying attention.
 
 
2 hours later…
9:29 PM
@MartinhoFernandes maybe you can help me with this
@MartinhoFernandes where can I find this portuguese text-to-speech voice, in episode 6 here: gibaeclaudinha.tumblr.com
 
10:05 PM
I bet everyone is looking at this chat waiting for someone to say something interesting.
 
10:15 PM
@StackedCrooked butt
 
Xeo
10:30 PM
Lately, I Ctrl-F ToS' and EULAs for "soul".
@Xaade used gust.
Hell yeah, I gained a whooping 7 Rep today!
 
10:54 PM
@Xeo Takes 9001 damage!!!
 
@Xaade: Casts Ultima.
 
11:09 PM
> When I was in university we did some Prolog assignments. One of the first bits of feedback I got for my code was something like: Syntax error in line 1. Operator expected.
> The "operator expected" bit scared me. I thought the local SysOp would come running into the room screaming "Who here had that syntax error?!"
:)
Anyone here knowledgeable enough to identify this fish?
 
11:28 PM
 
11:50 PM
Does anyone use unordered containers?
 
Xeo
Sure
 
Do you know whether hash_combine is part of the standard?
It's this 5-line function...
I just copied it from Boost, and I implemented a generic hasher for pairs and tuples from it. Boost also uses it for range-hashing, so you can hash entire containers.
But it's not part of GCC
 
Xeo
not part of VS either it seems
But I found something interesting
<hash_map>
 
I thought that's a shame, because one could easily hash all sorts of things until you're blue in the face
Ah, that old chestnut
That's been an extension provided by just about every vendor, I believe
I imagine that the unordered_map is not very different
 
Xeo
They both use the same _Hash base in VS
 
11:56 PM
VS10?
 

« first day (265 days earlier)      last day (4684 days later) »