Log inSign up
CPPAlliance
302 posts
CPPAlliance profile banner
@CPPAlliance

CPPAlliance

@CPPAlliance
Our mission is to make the C++ programming language accessible and useful to anyone who wishes to learn and apply the language.
Joined November 2017
36
Following
1,303
Followers
RepliesRepliesRepostsRepostsMediaMedia

Log in or sign up for X

See what’s happening and join the conversation

Continue with phone
or
Log in with username or email
Terms·Privacy·Cookies·Accessibility·Ads Info·© 2026 X Corp.
  • @CPPAlliance
    CPPAlliance
    @CPPAlliance
    18h
    int* p = &x; printf("%p", p); // ok std::cout << p; // ok std::format("{}", p); // error printf can format a pointer. iostream can format a pointer. std::format cannot 🧵👇
    2
  • @CPPAlliance
    CPPAlliance
    @CPPAlliance
    Sep 3
    filter_view caches the iterator from begin(). Call begin() again, it returns the cached position Now mutate the underlying range. The cached position may no longer satisfy the predicate Your next iteration silently skips elements or reads stale data. It's undefined behavior
    1
  • @CPPAlliance
    CPPAlliance
    @CPPAlliance
    Sep 2
    std::atomic protects shared data at runtime constexpr evaluates code at compile time. There are no threads at compile time So why would you want constexpr std::atomic? Because generic code shouldn't have to choose 🧵👇
    1
  • @CPPAlliance
    CPPAlliance
    @CPPAlliance
    Sep 1
    int x = 42, y = 42; std::reference_wrapper a{x}; std::reference_wrapper b{y}; a == b; // error reference_wrapper wraps a reference. But you can't compare two wrappers, even though the values they wrap are equal 🧵👇
    2
  • @CPPAlliance
    CPPAlliance
    @CPPAlliance
    Aug 31
    int a[] = {1, 2, 3}; int b[] = {1, 2, 3}; if (a == b) // false Same elements. Same order. Same size. The comparison returns false every single time C++ isn't comparing the arrays. It's comparing their addresses 🧵👇
    5
Advertisement
Advertisement