GSL
boost
GSL | boost | |
---|---|---|
23 | 17 | |
6,294 | 1 | |
0.6% | - | |
7.5 | 10.0 | |
about 1 month ago | over 14 years ago | |
C++ | C++ | |
GNU General Public License v3.0 or later | gtkbook License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
GSL
-
21st Century C++
I haven't read much from Bjarne but this is refreshingly self-aware and paints a hopeful path to standardize around "the good parts" of C++.
As a C++ newbie I just don't understand the recommended path I'm supposed to follow, though. It seems to be a mix of "a book of guidelines" and "a package that shows you how you should be using those guidelines via implementation of their principles".
After some digging it looks like the guidebook is the "C++ Core Guidelines":
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
And that I should read it and then:
> use parts of the standard library and add a tiny library to make use of the guidelines convenient and efficient (the Guidelines Support Library, GSL).
Which seems to be this (at least Microsoft's implementation):
https://github.com/microsoft/GSL
And I'm left wondering, is this just how C++ is? Can't the language provide tooling for me to better adhere to its guidelines, bake in "blessed" features and deprecate what Bjarne calls, "the use of low-level, inefficient, and error-prone features"?
-
60 terrible tips for a C++ developer
Already showed you how to use ranges and such above, gsl::final_action is here
-
Backward compatible implementations of newer standards constructs?
For span I would recommend the guideline support library - gsl::span
-
Hey Rustaceans! Got a question? Ask here (20/2023)!
Not sure how things are at this point so you might want to look up with those keywords, but a few years back clang-tidy was one of the suggested tools, or enabling the core guidelines checker in visual studio if you're using that. Maybe using GSL or something similar as well.
-
Hardening C++ with Bjarne Stroustrup
When I want safety guarantees, I use the original and run-time checked gsl::span, rather than std::span. https://github.com/microsoft/GSL .
-
I love building a startup in Rust. I wouldn't pick it again.
Another solution: use std::span (or some alternative implementations if the codebase doesn't use C++20).
-
C++23 “Pandemic Edition” is complete
If you ask me, the GSL [1] alone is a fairly radical departure from C++ that delivers a lot of safety. I don't know if it's gotten much popularity, though. Probably because it introduces a similar disruption like you might find from a brand new programming language.
[1] https://github.com/microsoft/GSL
-
Using Rust at a startup: A cautionary tale
> With Rust, though, one needs to learn entirely new ideas — things like lifetimes, ownership, and the borrow checker. These are not familiar concepts to most people working in other common languages ... Some of those “new” ideas are, of course, present in other languages — especially functional ones.
With C++, lifetime and ownership are just about as important but unfortunately no one's got your back. You can ignore lifetimes and ownership but you do so at your own peril. And the compiler won't tell you you're doing it wrong because the language wasn't designed for it to do so.
If you want a taste of rust's "mindset" (with respect to limitations imposed by some types) without jumping ship to a new language, try C++'s Guidelines Support Library [1]. It introduces some of the same benefits/friction as switching to rust but without a new language. Opting-in to some of these guidelines might be a gentler way to get some of the benefits of Rust. But it comes with a similarly higher bar.
[1] https://github.com/microsoft/GSL
- Passing a std:: array as a function parameter
-
I created a memory leak using smart pointers
It's also far more verbose than T* or T& (probably intentionally). If you really want a non-nullable pointer, gsl::not_null from the GSL is a good option. Writing your own version is also trivial, if you don't want to add a dependency.
boost
- Inside boost::unordered_flat_map
-
coost v3.0.0 released - A tiny boost library in C++11
coost is a cross-platform C++ basic library with both performance and ease of use. It is like boost, but much smaller, the static library built on linux and mac is only about 1MB in size. Although small, it provides enough powerful features:
- Ask HN: Is ease in getting started the key for Python's success?
-
Compile-Time Hash in Plain C (Not Only C++) is Now Possible!
For those who didn't know what is Boost, it's a C++ library that helps to prevent re-inventing the wheel while trying to program something quite complex as example looping only with macro, Boost Preprocessor. Fortunately, Boost Preprocessor Repeat also works with plain C, not only C++. So, my OrangePi board can calculate hash at compile-time. Unfortunately, my SIX Hash algorithm requires sizeof(input) and Boost... won't... work... with it. Hours of workarounds, no luck.
-
How do I connect a REST API with C++?
If you have the ability to use third-party libraries (though if you can't this project is going to be a nightmare, lol...) I would recommend using the Beast library from the Boost collection of libraries. It's a little bit more verbose than some options, but not that much more, and it's better maintained. REST webservices are built on top of the HTTP framework, so it's just a matter of sending a HTTP GET request to a server (or POST/UPDATE/DELETE, depending on how exactly the api on the other end is implemented) and reading the response you get back. This is a very basic sample of a client sending a GET request to a server. If you need to change this to do a POST (or some other kind of request), there's only two real changes that need to be made:
-
Can anyone explain the differences of Conda vs Pip?
The person you replied to used slightly confusing terminology. Conda deals with non-python packages. As in if you wanted to install boost for C++.
-
Looking to download/use Boost
I'm not sure if its just me but I'm finding I can't access any of the download links on the Boost Website.
- Resources for experienced C programmer for C++20/17/13
-
How to write reflection for C++
rich standard library and Boost;
-
Where to read about modern C++ features which you should use?
Boost is also another ubiquitous library. Lots of code that doesn't make it into the standard kind of ends up here. Lots of code that gets into the standard starts here. Boost.Asio might end up being our network API in 23.
What are some alternatives?
cppinsights - C++ Insights - See your source code with the eyes of a compiler
restclient-cpp - C++ client for making HTTP/REST requests
span-lite - span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
coost - A tiny boost library in C++11.
sentry-native - Sentry SDK for C, C++ and native applications.
flat_hash_map - A very fast hashtable
CppCoreGuidelines - The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++
boost - cmake based plugable static compiled boost library
C-Golang-like-Defer - Cursed defer() method in C++ achieves similar results as Go's defer keyword.
staged-recipes - A place to submit conda recipes before they become fully fledged conda-forge feedstocks
cpp-core-guidelines-cheatsheet - Cheatsheet for the C++ core guidelines, including a set of tried-and-true guidelines, rules, and best practices about coding in C++.
jackson-databind - General data-binding package for Jackson (2.x): works on streaming API (core) implementation(s)