Bobinas P4G
  • Login
  • Public

    • Public
    • Groups
    • Popular
    • People

Notices by Šimon Tóth (simontoth@hachyderm.io)

  1. Šimon Tóth (simontoth@hachyderm.io)'s status on Friday, 23-Jun-2023 20:47:19 UTC Šimon Tóth Šimon Tóth

    When working with C++20 views, creating functions that encapsulate complex view compositions might be tempting.

    However, that will very likely lead to unnecessary data copies. Instead, consider compositing views as inline constexpr variables.

    Compiler Explorer link: https://compiler-explorer.com/z/vG4hhe77h

    #cpp #cplusplus #coding #programming #dailybiteofcpp

    In conversation Friday, 23-Jun-2023 20:47:19 UTC from hachyderm.io permalink

    Attachments


    1. https://media.hachyderm.io/media_attachments/files/110/572/132/460/711/982/original/6dba6a91bb46484c.png
    2. Compiler Explorer - C++
      from Matt Godbolt
      constexpr inline auto trim_front = std::views::drop_while([](int c) { return std::isspace(c); }); constexpr inline auto trim_back = std::views::reverse | trim_front | std::views::reverse; constexpr inline auto trim_space = trim_back | trim_front; int main() { std::string str = " abc \t"; // Compose the view with data auto lazy_trimmed = str | trim_space; // Generate the output (before C++23 std::ranges::to) std::string out(lazy_trimmed.begin(), lazy_trimmed.end()); // out == "abc" std::cout << "out == " << std::quoted(out) << "\n"; }
  2. Šimon Tóth (simontoth@hachyderm.io)'s status on Sunday, 19-Mar-2023 19:55:03 UTC Šimon Tóth Šimon Tóth
    in reply to
    • Bernie

    @codewiz LOL, want import std; before we have C++20 modules support?

    In conversation Sunday, 19-Mar-2023 19:55:03 UTC from hachyderm.io permalink

User actions

    Šimon Tóth

    Šimon Tóth

    Daily bit(e) of C++ | ex-SWE, ex-Researcher | Currently dumping my 20 years of SWE experience into articles &amp; videos.

    Tags
    • (None)
    ActivityPub
    Remote Profile

    Following 0

      Followers 0

        Groups 0

          Statistics

          User ID
          39164
          Member since
          18 Mar 2023
          Notices
          2
          Daily average
          0

          Feeds

          • Atom
          • Help
          • About
          • FAQ
          • Privacy
          • Source
          • Version
          • Contact

          Bobinas P4G is a social network. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.

          Creative Commons Attribution 3.0 All Bobinas P4G content and data are available under the Creative Commons Attribution 3.0 license.