sftrabbit / CppPatterns-Patterns

A repository of modern C++ patterns curated by the community.
Creative Commons Zero v1.0 Universal
1.43k stars 223 forks source link

Examples that involve non-standard libraries #19

Open KrisSiegel opened 9 years ago

KrisSiegel commented 9 years ago

Is the goal of this website to provide examples only for standard libraries or will it branch out to non-standard? The reason I ask is it's been 10 years since I've done C++ work and these examples are really awesome but when I look for examples that, say, use TCP/IP it's almost impossible to find good, modern libraries and coding techniques.

If there is interest in this I may try to provide some PRs in the interest of my own personal learning :)

sftrabbit commented 9 years ago

I am undecided on this at the moment. It had originally been my plan to have a category of samples which were just examples of using libraries. I had two thoughts against it though:

  1. There are way too many libraries out there. How could C++ Samples be the go-to resource for them all? Isn't it better for the library maintainers to provide their own documentation?
  2. It would require some extra work to integrate this with the current site build process (as testing the samples will required having the appropriate libraries available).

Further thoughts are appreciated though!

KrisSiegel commented 9 years ago

Yeah I understand including samples with external libraries is a bit of a slippery slope. It probably makes sense to not do those at all otherwise if this web site is popular enough everyone is going to want samples for their library to be on it. At the same time there is a real need for good samples for popular libraries because many of them rarely even use C++ 11 features where they could.

I wonder if a good middle ground may be proving an area where only C++ / STL features are shown off and another area where users can simply submit / publish their own. I mean it kinda duplicates Gist in terms of capabilities but it's also nice to have a central repository.

Not sure if that's a good idea or a horrible idea.

At least for TCP/IP perhaps coverage of that should be handled using the standard networking library currently being proposed for C++ 17 / C++ 1z.

sftrabbit commented 9 years ago

I quite like the idea. Perhaps even just a page on the site that lists gists that people submit. That might be interesting (but could easily become cluttered). I'll have to think some more about this.

KrisSiegel commented 9 years ago

That sounds good. Thanks!

mauve commented 7 years ago

I think introducing external libraries would be wise. Look for example at http://www.cppsamples.com/patterns/observer.html which doesn't handle lifetime of the "connection". This usually works for GC languages but is a really huge problem in C++. In Boost.Signals2 and Sigc++ have this as one of the core features.

Therefore I think using external libraries should probably be the default for some usecases even.

I can whip up a PR if/when we agree.

All the best