« first day (1532 days earlier)      last day (3421 days later) » 

7:00 PM
Have you ever used this technique? It essentially (kinda) enables you to add new methods to a class without touching the header file.
 
alright
let's Lounge that fuck.
-1
Q: Recuresevly reverse a string

kuhakuI'm trying to write a recursive function that will reverse a string, I'm pretty sure my basis for the recursion is solid, but I can't get it to work... Basis: if the length is <= 1 stop. Else, swap the first and last elements and advance one element forward and reduce the length by 1. I'm havi...

 
aah UB
 
user1804599
@StackedCrooked eww use free fucktions you moron
 
Which C++ reference do you guys youse?
 
his question's in C.
 
7:02 PM
@rightføld But ..Java!
 
user1804599
Fück Java.
 
user1804599
Use Scala instead. :>
 
Minecraft == java
lagg
 
@rightføld Btw, you get access to the class privates as well.
 
@Puppy LOL
 
7:03 PM
Unless if it's using pimpl.
 
Show the revision, show the revision :D :D :D
 
user1804599
@StackedCrooked You can do that in Scala too.
 
@Stacked what's the "nullptr allocator"? :P
 
@AndyProwl It's a trade secret ;)
 
user1804599
7:03 PM
class A {
    private val x = 1
    private val y = x // look mah, I have access to a private member
}
 
Fastest allocator.
 
That guy, fucking hilarious
...ly stupid
 
Ell
@StackedCrooked I forgot how to get raw source from coliru url
 
@Ell You can find the message in the bottom of the page.
 
@StackedCrooked but won't this cause unresolved symbol linker errors? The template specializations are in separate .cpp files
 
7:08 PM
Hm.. When I used it I put them in same source file. Never tried putting them in different .cpp files.
 
if they are in the same file it won't be a problem, because the client sees their definitions
I think
you would have to use explicit instantiations if you want to relegate the implementation of the function template into some cpp file
 
@rightføld stop playing with your privates
 
(again, I think)
 
user1804599
No.
 
I feel sloppy about this
 
user1804599
7:11 PM
They're pubic.
 
@AndyProwl I think it works like a function declaration and function definition. Declaration can be repeated and definition must be defined only once, doesn't matter where.
 
@StackedCrooked templates work differently, though. When a translation unit encounters a function template call, it needs to see the definition of that function.
 
that's not strictly true.
 
I think you may relegate the definition to some separate CPP file if you use explicit instantiations
 
only if the compiler needs to instantiate it.
 
7:14 PM
but then you have to know all the instantiations in advance
 
yes.
 
Explicit instantiation is needed when you put the definition of a function template in a source file, as you would with a regular function. Then you need to put explicit instantiations in that same source file for each instantiation triggered by calling it.
 
er, no.
 
But in my situation each instantiation has it's own separate code.
 
what would be the point of that?
oh wait, nm, misread.
you probably need to declare specialized versions of that function and also declare an extern instantiation of it.
then implement that specialization in the other file.
 
7:17 PM
@StackedCrooked not sure I understand. I'm convinced that if you took the example you posted and actually laid it out on several files as hinted by the comments, you would get linker errors
 
ok
that kuhaku guy is really starting to fuck me off a bit.
 
who?
 
@EmpereurAiman ok
although nobody asked for your opinion
I've no choice but to respect it
 
3
Q: Recursive function to reverse a string

kuhakuI'm trying to write a recursive function that will reverse a string, I'm pretty sure my basis for the recursion is solid, but I can't get it to work... Basis: if the length is <= 1 stop. Else, swap the first and last elements and advance one element forward and reduce the length by 1. I'm havi...

This whole question is a total writeoff. The OP has a bunch of totally arbitrary restrictions that were written by a total moron (and hardly any of the answerers seem to have been able to read it properly), none of the answers will be of any use to anyone except himself even if someone does succeed, doesn't know anything about C vs C++, where and why it matters, and won't accept actual help that might turn his program into a vaguely useful one or his question into a somewhat clear one. Just nuke the whole thing from orbit. — Puppy 1 min ago
 
> The OP has a bunch of totally arbitrary restrictions that were written by a total moron
How about behaving normal to people?
There's no need to insult anyone
 
7:29 PM
Those restrictions are indeed arbitrary and only a moron could've written them.
 
WHo the fuck want to know how to reverse a string anyway and, even if there is some perverse need, why would anyone choose recursion?
 
Ell
Ive no idea
 
@MartinJames "It's a teaching exercise."
 
(So, retarded "teachers".)
 
7:32 PM
@AndyProwl If you check the whole comment thread, you will see that the OP repeatedly rolls back people's attempts to fix his question.
 
I'm not really insisting but if it's illegal then why does it work with VS? @Griwes — kuhaku 30 secs ago
that guy is a total moron
 
@MartinJames schools
the teacher's expected solution probably looks like this or sth
reverse(str) = {
	append(reverse(substr(str, 1)), str[0]), str != ""
	"", otherwise
}
not sure if I got it right
 
[braces for VS flamewar]Robert Harvey ♦ 1 min ago
:D
 
Pup etc. are right. It's a stupid exercise invented by stupid people for a stupid purpose and using a stupid implementation.
I've been writing software for decades, and I've never had to reverse a string, ever.
 
Still not a reason for calling people's name
Not insulting anyone isn't that hard
3
 
7:36 PM
I find it incredibly difficult, sometimes:(
 
@AndyProwl So we shouldn't be calling retards retards and morons morons?
Telling a person he's stupid when he's stupid is not an insult.
 
For instance:
http://stackoverflow.com/questions/27608671/asynchronous-reading-a-file-with-using-pthread
 
@Griwes The fact that he's stupid is your opinion. Not everyone who behaves improperly is a "total moron".
 
@AndyProwl Everybody who behaves like a total moron is a total moron.
 
The only result is that people start insulting each other instead of focusing on the problem
 
7:38 PM
@Griwes or a troll
 
s/troll/flamebaiter/
 
@Griwes So, should the world obey your standards of what represents moronic behavior?
Just because you feel X, it doesn't mean it is X
It costs you nothing to avoid calling people's names
 
I feel that it does.
 
also jesus this is an exercise about recursion so that the students can work with something more difficult than a factorial or fib
it's pretty obvious to me
 
You don't like him? Just don't help him
 
7:40 PM
no need to go "this is the wrong way to reverse a string!!!"
 
Leave him in his trouble, as easy as that
 
other people may not appreciate how stupid his question is and that they shouldn't do shit like that.
@AndyProwl If that was the only effect, I'd agree. But it isn't.
other people are gonna pass by and see his question.
and they need to be warned off.
 
no, they don't
they can form their opinion just like you did
plus, I agree with Alex
 
yes, and it needs to be an informed opinion.
 
If I can't call people names, you else can I fight back against the massive tide of gruesome questions from mor.. er.. stu.. err.. 'badly behaved' posters?
 
7:41 PM
namely, informed by the fact that what the OP is doing is dumb as shit.
 
all the information is there for judgement
don't assume people are stupid, although they are likely less clever than you
 
only if you're already fully informed about the language, libraries, and techniques.
which will not describe any meaningful proportion of passers-by.
 
that will come. No one will take you seriously when you sound like a barking dog anyway
 
it will come only after they write a bunch of shit code that other people have to fix.
probably Stack Overflow, where they will come when they can't make their shitty code work.
and it's better that they just don't learn to write shit code in the first place.
 
7:43 PM
if you really want it, it's enough to leave a message saying that this is the wrong way of going about solving that problem, no need to spread insults here and there
 
no, the insults are for the OP's behaviour in response to my initial completely non-insulting corrections.
 
At the root of that question is a teacher/prof/TA who thinks that exercises that suggests that all that parameter-passing and call-sequences is as acceptable as a char-swap loop.
 
@Puppy and what did he do to deserve your insults? Did he call you an asshole? Or just reverted your edit?
 
If profs would come up with exercises where recursion is actually a sane solution then fine.
 
@StackedCrooked hm, then I obviously suck and should go back to study this
 
7:47 PM
@MartinJames Erasing all nodes from a tree :)
mNodes.clear(); // stack overflow
 
Ell
Like tree traversal
 
I fixed by navigating to a leaf and then work my way upwards deleting nodes.
 
@StackedCrooked That would do, or 'print out a long int using any passed base in the range 2-16'.
 
I liked the idea of recursive string reversal when I first saw it
I never really thought about returning pieces of strings like that
and glueing them together
 
@AndyProwl You make it sound like reverting the edit doesn't waste the time of everybody who has certain tags favourited or ignored.
 
7:49 PM
it was a funny way for me to look at it back then, lol
 
The first implementation of regex was only two functions using mutual recursion.
 
@Puppy Then just tell he's wasting your (and his own) time by reverting people's edits and leave him alone.
 
what, and leave all those other people to be harmed by his bad code and bad tagging?
 
you can vote to close
 
I did
 
7:51 PM
so you did your part
 
but that's clearly not enough
 
you did your part, that's enough
let others judge too
 
well, they're not pulling their weight
 
plus, if you will call your colleagues "total morons" every time you will think their behavior is silly or inappropriate, good luck surviving in a work environment
 
Ell
@StackedCrooked one for open delimeter, one for close? O.o
 
7:54 PM
I understand we're nerds but it's not like social conventions don't apply to us
 
Ell
Wait that makes no sense.
 
they absolutely do apply to us
 
@Ell Found it. Apparently they used 4 functions.
 
and the appropriate convention here is "Build sewers and keep the harmful shit away from the children".
 
@Griwes what problem does it solve?
 
7:55 PM
@StackedCrooked Master class in unreadability.
 
matchhere, matchh and matchstar
 
user1804599
Awesome.
 
user1804599
I wrote a tool that draws a graph from ping times in real-time.
 
@JohanLarsson It apparently solves the problem of not feeling better by insulting people.
[to be parsed as: not (feeling better by insulting people)]
 
user1804599
 
user1804599
8:00 PM
woooooooo
 
@AndyProwl so more a symptom than a solution?
 
that's how I see it
 
I can agree with that view
I'm always in this ivory tower here
 
I can hear snow hitting my office window. Wonderful. I'll need a yardbrush to find my car, (again).
 
lots of rain here but no snow
 
8:03 PM
At least to my taste.
 
@StackedCrooked Fails for a 1-character regex.
 
Well, who'd use a 1 character regex.
Only silly people would do that.
 
dunno but it's not illegal so
 
Intelligence is assumed.
:P
 
meh
there's no inherent reason to believe that 1-char regexes are useless.
 
user1804599
8:07 PM
Empty regex ftw.
 
user1804599
It doesn't discriminate.
 
user1804599
Etienne would love it.
 
Ell
Lol
 
It returns less results for women.
 
hmph
 
user1804599
8:09 PM
hectometer per hour
 
well it was nice to see my family for Christmas
but it seems that's basically all I've done
 
Did you drink a lot?
 
and I've paid about 7 hours of pointlessly dicking around with nothing to do for every hour of actual family time.
bad bargain
 
@Puppy Daisy.
 
@Puppy Travel time?
 
8:10 PM
@StackedCrooked No, no machine here.
 
I've been here for nine days and being in the Lounge is the limits of my computational power
@MartinJames She did get in some woofing and some hungry dancing.
but again, not sure if it's really worth it considering how much holiday I expended
 
user1804599
@StackedCrooked Next time I'm gonna buy shoes I'll ask whether they have empty regex shoes; they match all outfits.
 
Ell
I feel like shit now cos I've had no sleep and I'm way dehydrated
 
then drink something and go to bed
@rightføld Does the empty regex match everything or nothing?
 
Ell
8:13 PM
@Puppy do something productive and fuck off then :P
 
user1804599
@Puppy everything, of course.
 
Ell
I reckon nothing.
 
@Ell Can't.
 
Ell
It matches an empty string
 
user1804599
^$ matches only the empty string.
 
user1804599
8:13 PM
Whereas matches everything.
 
user1804599
The empty regex is equivalent to finding the empty string in a string.
 
user1804599
Or a state machine of which the initial state is an accept state.
 
Ell
@Puppy go for a jog
 
looked outside?
also I can't go for a jog as the sole thing for a whole week.
@rightføld Not sure I'd argue that any string contains the empty string.
 
user1804599
All strings contain the empty string.
 
8:16 PM
definitely not really feeling that
 
I fancy a run too. Unfortunately, my world is all white ATM.
 
user1804599
@Puppy It is generally accepted that the result of concatenating a and b contains both a and b.
 
not feeling that that has to hold true when a or b is empty string.
 
@Puppy read a book? you could learn something new. Or write an article and teach something new
 
user1804599
Not holding on to that invariant would make many things immensely complicated.
 
8:19 PM
@AndyProwl I've no idea how to actually put the article in front of any reasonable number of people.
 
@Puppy You have a website, and you can suggest the link on isocpp
 
user1804599
Because special cases suck.
 
I could do that.
not sure if they'd accept.
 
I don't know how the revision process works, but it seems to me even low-quality stuff gets through as long as it is about C++
so you shouldn't have problems getting your articles linked
unless you rant about how the Committee is just a bunch of morons :P
 
it is but I doubt I'd write about that.
maybe I'll write about dependencies in C++
 
user1804599
8:28 PM
Write about your dog.
 
Boost, Clang&LLVM, libarchive/zlib, premake, I've got a few.
 
user1804599
Pretty sure the committee loves bitches.
 
@Puppy sounds interesting
 
and I might write about my experience using them.
 
oh god
dug out 3 year old code on what I thought it would be a great idea to make an inventory and item use system in unity
 
user1804599
8:37 PM
Might as well use LLVM and Boost.Coroutine for Styx.
 
the horror
THE HORROR
 
user1804599
Also does Boost have thread pools?
 
user1804599
Because the thread pool I wrote has race conditions and sucks.
 
this is horrible
I had written content as verbatim strings for formatting =)
wtf
 
i think no thread pool
 
8:47 PM
it's weird because I know future me will look at today's solution and say "what the hell was I thinking"
but I can't come up with a future solution
but really I'm replacing this mess with a proper GUI to edit items, that can't be bad, can it
 
user1804599
Could use boost::thread_group with boost::asio::io_service as a thread pool.
 
user1804599
 
@SteveJessop that's a stateful, deterministic, copyable generator. How about one that would semantically yield an InputTraversal range: demo (note two unrelated fixes that prevent side-effects on end-iterator construction and avoids comparing freshly constructed iterators as equivalent regards of of their is_end flag). The point is that it's too much to promise forward_iterator_tag semantics, because it depends on the semantics of the source generator. — sehe 2 mins ago
Am I explaining it badly?
@rightføld search my answers for thread_pool. Be happy. It's kinda trivial using boost.
 
user1804599
Perhaps with std::future to return the result.
 
user1804599
Although in my case I don't need any results.
 
8:58 PM
@rightføld that's unrelated to the pooling. Use packaged_tasks
 
user1804599
Ah.
 

« first day (1532 days earlier)      last day (3421 days later) »