peltorator's blog

By peltorator, 23 months ago, In English

Ranges and views from c++20 are cool. Today I have learned that C++23 brings even more fun stuff from python to c++. For example, zip and enumerate. These are some of the features from python that I missed the most in c++. Also, now there is a thing called cartesian product which helps one to avoid writing 5 nested loops.

I think these things could be pretty handy for competitive programming, so I would like to ask: what other features of c++23 do you find interesting? And when do you think we could get c++23 on Codeforces?

  • Vote: I like it
  • +47
  • Vote: I do not like it

| Write comment?
»
23 months ago, hide # |
 
Vote: I like it +21 Vote: I do not like it

Deducing this, std::flat_map, std::print

  • »
    »
    23 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I've looked at std::flat_map and didn't understand the point. Is it just worse than std::map?

    • »
      »
      »
      23 months ago, hide # ^ |
       
      Vote: I like it +24 Vote: I do not like it

      In some cases, this actually seems useful for finding a balance between time and memory. For example, it seems that it is better to use flat_map when storing edges at the node of a trie.

      As far as I understand this is just an implementation like vector<pair<Key, Value>> with sorted Keys. And it works great with cache.