1. X
  2. Boost C++ | Open Source Libraries
Log inSign up
Boost C++ | Open Source Libraries
482 posts
Image
user avatar
Boost C++ | Open Source Libraries
@Boost_Libraries
Open source C++ libraries: algorithms, data structures, concurrency, networking & more. Peer-reviewed, portable, battle-tested since 1998. boost.org
Global C++ Community
boost.org
Joined March 2017
217
Following
3,650
Followers
RepliesRepliesMediaMedia

New to X?

Sign up now to get your own personalized timeline!

Create account

By signing up, you agree to the Terms of Service and Privacy Policy, including Cookie Use.

Terms·Privacy·Cookies·Accessibility·Ads Info·© 2026 X Corp.
Don't miss what's happening
People on X are the first to know.
Log inSign up
  • Pinned
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Sep 10, 2025
    Level up your C++ skills! Sharpen your code with the latest from the Boost Libraries, powerful, peer-reviewed, and production-ready New in Boost: Bloom – High-performance Bloom filters → boost.org/libs/bloom Hash2 – Modern, flexible hashing library → boost.org/libs/hash2
    Image
    9.5K09.5K
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 17
    You have a million 2D points and a question: which fall inside this rectangle, and what are the five nearest to here? A linear scan is O(n) per query. Standard C++ has no spatial index, so most people write a slow loop and hope 🧵👇
    4K04K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 17
    Boost Blueprint 086: Boost.Geometry (R-tree) An rtree spatial index answers window queries and k-nearest-neighbor searches in logarithmic time instead of a full scan Bulk load millions of points or boxes, then query with intersects, within, or nearest predicates Level up your
    Image
    9900990
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 17
    Image
    godbolt.org
    Compiler Explorer - C++
    namespace bg = boost::geometry; using point = bg::model::point; int main() { // Insert points into a quadratic R-tree spatial index bg::index::rtree> tree; for (int i = 0; i < 10; ++i) tree.insert(...
    6120612
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 16
    How do you store several unrelated types behind one interface when you don't own half of them, and don't want vtables leaking into your value semantics? 🧵👇
    2.8K02.8K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 16
    Boost Blueprint 085: Boost.TypeErasure Define the behavior you need as a set of concepts, then hold any type that satisfies them in a single any<...> value: no shared base class, no inheritance, value semantics preserved Non-intrusive runtime polymorphism for types you don't
    Image
    6610661
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 16
    Image
    godbolt.org
    Compiler Explorer - C++
    namespace te = boost::type_erasure; // A "printable" concept: any copyable type with operator<< using printable = te::any< boost::mpl::vector< te::copy_constructible<>, te::ostreamable<> >>; //...
    3550355
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 15
    std::string calls malloc behind your back. Past the small buffer optimization, every assignment quietly hits the heap On a hot path, that's surprise latency. In embedded or real-time code, you can't allocate at all What if you know the max length at compile time? 🧵👇
    7.1K07.1K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 15
    Boost Blueprint 084: Boost.StaticString A fixed capacity string, static_string<N>, that stores its characters inline with zero heap allocation and a std::string-compatible interface Overflowing N is a defined, catchable error, not a silent reallocation. You can even use
    Image
    1.1K01.1K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 15
    Image
    godbolt.org
    Compiler Explorer - C++
    template label_> struct labeled { static constexpr auto label = label_; T value; }; int main() { // Capacity fixed at compile time, chars stored inline - no heap boost::static_string<32> name; name =...
    7170717
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 14
    Your service maps JSON to structs by hand. Every new field means editing the struct, the parser, and the serializer, and keeping 3 copies in sync. Miss one and you ship a silent data bug What if adding a field meant changing one line? 🧵👇
    2.6K02.6K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 14
    Boost Blueprint 083: Boost.JSON + Boost.Describe Annotate your struct with BOOST_DESCRIBE_STRUCT once and value_to<T> / value_from convert straight between JSON and your type, with no handwritten field mapping. Add a member, list it in the macro, done Level up your C++
    Image
    6270627
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 14
    Image
    godbolt.org
    Compiler Explorer - C++
    struct Config { std::string host; int port; bool tls; }; // One declaration drives both parsing and serialization BOOST_DESCRIBE_STRUCT(Config, (), (host, port, tls)) int main() { // JSON -> struct,...
    3780378
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 13
    Try to add one month to Jan 31 in standard C++, or iterate every month-end across a year std::chrono gives you no adjusted month increments and no date-period handling. "When are Tom and Sue both OOO?" still has no standard answer 🧵👇
    2.9K02.9K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 13
    Boost Blueprint 082: Boost.DateTime Calendar aware dates and durations: add months and years with end-of-month handling, iterate over days/weeks/months/years, and get off the shelf date-period algebra Date and time calculations for humans Level up your C++ architecture. Follow
    Image
    5050505
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 13
    Image
    godbolt.org
    Compiler Explorer - C++
    int main() { using namespace boost::gregorian; date d(2026, Jan, 31); // End-of-month aware month arithmetic (std requires manual calculation) date next = d + months(1); std::cout << next << '\n'; //...
    3340334
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 10
    C++26 finally allows std::optional<int&>. But most codebases won't see C++26 for years Until then, a nullable, rebindable reference means falling back to raw pointers and losing the "maybe" from your type. Or does it? 🧵👇
    5.5K05.5K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 10
    Boost Blueprint 081: Boost.Optional It has supported optional<T&> for over a decade: a nullable, rebindable reference with value semantics, no raw pointers required Plus additional goodies such as conditional construction, monadic operations from C++11 up, and iostream support
    Image
    9760976
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 10
    Image
    godbolt.org
    Compiler Explorer - C++
    // Return an optional reference into a container - pre-C++26 std::optional can't boost::optional find_first_even(std::vector& v) { for (int& x : v) if (x % 2 == 0) return x; // binds a reference, not...
    5700570
  • user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 9
    Convert a string to a number in standard C++: std::stoi, but no std::itoa. to_string(3.14) gives you trailing zeros. <charconv> wants pointers and an out-param. stringstream is five lines All you wanted was one generic function that does the right thing in each direction 🧵👇
    5K05K
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 9
    Boost Blueprint 080: Boost.LexicalCast One function, both directions: lexical_cast<int>(s), lexical_caststd::string(42), lexical_cast<double>(sv) Throws bad_lexical_cast on failure, or use try_lexical_convert for a bool return. Works for any type with stream operators Level up
    Image
    8790879
    user avatar
    Boost C++ | Open Source Libraries
    @Boost_Libraries
    Jul 9
    Image
    godbolt.org
    Compiler Explorer - C++
    int main() { // Text -> value, one uniform call int n = boost::lexical_cast("42"); double d = boost::lexical_cast("3.14159"); // Value -> text, the same function std::string s = boost::lexical_cast(n...
    5840584
Advertisement
Advertisement