Related SO question: Ad hoc polymorphism and heterogeneous containers with value semantics

  • I have this problem that has been bugging me for ages.
  • Truckloads of people ask about the very same problem, just maybe not in the exact same wording, and yet they always get what I feel is inadequate answers.
  • I didn't find any question/answer that (IMO) fully solves it, be it on SO or elsewhere.
  • I finally found a simple and elegant solution (yes I know this contradicts the previous statement, please just think chronologically, ta).

So I felt compelled to share my find on SO.

I made as much efforts as possible to make it a good Q/A in the SE style ("ingenuous" question, detailed answer) but nobody's perfect and I definitely am not so I'm asking for any specific advices and opinions you can throw at me to make it better.

Side question: since I "ripped it off" someone else, would it be better to make it Community Wiki? I don't really care that much about rep (though I'll still gladly take it if I "must" :-p), my main concerns are, priority-wise:

  1. Help others.
  2. Stay inside the "limits" of a community I don't know that much yet (only been active here for about 6 months).
  3. I already told you I don't care that much about rep. Maybe just a little bit, though. :-p
  • 1
    In addition to what Wesley said, nice work on the meta discussion. You really put some thought into this.
    – Shog9
    Sep 17, 2013 at 23:05

2 Answers 2


I'm not familiar with the material, but I still have to say:

Nice job.

You posted in true Q/A fashion, most people fail to do that. They often pose a non-question, or something trivial that has a million dupes, or something way too broad, or try to collect a big list of "answers" (poll style). Then they defend it by saying "Hey, self answered questions are allowed!" Sure they are, but they still need to meet the criteria for a proper question.

When posting the question you have to consider: would someone really ask this? Or is it a pretense so I can paste some cool code I wrote?

Using an outside source isn't necessarily "ripping off", and "I don't deserve the rep" to me is not the point of Community Wiki. You credited your source and put a lot of effort into this and deserve the recognition.

Things I think that could use improvement:

It's a long post. I'd prefer to see the "fluff" removed, for example:

Actually it's so simple it hardly needs any explanation at all, the code speaks for itself. Almost depressing, considering how long I banged my head against a good number of walls (one wasn't enough) trying to figure out how to achieve it...

Not really necessary. Also the whole "Afterword" section can get removed:

I guess that's it. My mind was so blown when I realized how simple, elegant and obvious this solution was for a problem that's been bugging me for ages, that I felt compelled to share it here. Some gurus will probably go "meh" but this really is, IMHO, a superb expert solution to a problem that every newbie and their dog often face. Again, kudos to Sean Parent for sharing it in the first place.

I realize I didn't explain much, only the most important parts, so feel free to ask for clarifications if you don't understand something, and/or edit this Q/A to add more details or correct my poor English.

At best, these are comments. No need for that stuff. I understand it's personal style but it detracts from the information that people actually care about.

Otherwise, well done.

  • 1
    Ah thanks, that's exactly the kind of advice I was looking for when I asked here. You're right, it's personal style: I try to be "funny" and "friendly" within reasonable limits, just to lighten the load of the heavily technical subject -- but it seems I did it too much. Will fix. Thanks!
    – syam
    Sep 17, 2013 at 18:34
  • 2
    No offense to you, a lot of people write like this, but I find it annoying. Once I see "filler content" (something that doesn't pertain to the topic I'm there to read about) I stop reading and start scanning. One more thing: be open to possible better answers (or answers that have a different perspective) being posted later on.
    – user159834
    Sep 17, 2013 at 18:35
  • 1
    No offence taken, again that's exactly the kind of feedback I was hoping for. I'm not used to such a big and diverse audience as SO so any opinion is welcome, and I realize my style is not necessarily the best out there.
    – syam
    Sep 17, 2013 at 18:41
  • 2
    There are tech blogs out there that go like: "So I took a sip of my freshly brewed fair-trade organic cofee, rolled up my sleeves, cracked my knuckles and started prototyping a solution by the dim glow of the street lights coming into my apartment, my cat Noodles softly purring on my lap while I typed away vigorously at the keyboard..." Ugh, just shut up. I'm here because I want to learn something. (that's just me though, I suppose some people enjoy it)
    – user159834
    Sep 17, 2013 at 18:45
  • Right, that kind of writing also drives me up the wall. Finding a good balance is difficult, but at least when you lean on the "dry" side there's little chance to get it wrong. Lesson learned. :)
    – syam
    Sep 17, 2013 at 18:50
  • 1
    I'll accept your answer, you've been very constructive in your criticism which was the very goal of my question here (hey, I'm a also programmer, I don't care that much about well done's I only really care about this detail could be improved). ;-)
    – syam
    Sep 17, 2013 at 20:05
  • The filler thing is especially annoying in computer books, and is the reason I find books like C# in a Nutshell by Albahari (which ironically weighs in at over a thousand pages) so refreshing. No fat, just meat.
    – user102937
    Sep 17, 2013 at 21:13

This is perfectly legitimate: As Jeff wrote long ago, "It's Ok to answer your own question"

In your answer, you gave credit where it was due, answered a real question that you faced, and made the Internet a better place.

In short, home run!

  • Thanks for the encouragement. Indeed I tried to meet all the goals you described, but you know how it is: been there just few months, think I've understood how it works but still unsure... Glad to see I was not too far off. Still, constructive criticisms are welcome (again, I posted it for my peers not for me since now I already know the answer, so I might as well try to make it as best as I can). ;)
    – syam
    Sep 17, 2013 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .