New answers tagged

0 votes

C++17 Recursive Fibonacci calculation with memoization

I know question is 2 years old, but my two cents for gcc ver > 6.1, if it helps ...
3 votes
Accepted

Ackermann-Péter function call count using Writer monad

The first thing that jumps out is these lines: let (secondArg, count) = runWriter $ ackCount m (n-1) tell (Sum $ getSum count) You're not ...
1 vote
Accepted

The usages of make_view Template Function in C++

This isn’t really very useful. What you want to do, in just about every case I can imagine, is create the transformed data structure. It meets the requirements of ...
  • 3,341
1 vote

A recursive_transform_view Template Function which returns a view in C++

This is not useful Davislor mentioned correctly that: Returning a non-owning view of a temporary object will result in a dangling reference! So what you really want to do is create the transformed ...
  • 42.4k
1 vote
Accepted

A recursive_transform_view Template Function which returns a view in C++

Do I Contradict Myself? Very well, then I contradict myself. Since you asked specifically about the use of std::ranges::subrange versus ...
  • 3,341
1 vote

A recursive_transform_view Template Function Implementation

Please Post a More Minimal Example There’s a lot here that was copied from other answers, or implements a completely different algorithm than the one you’re asking for feedback on. At least split up ...
  • 3,341
1 vote
Accepted

A recursive_transform_view Template Function Implementation

The name is wrong Calling this recursive_transform_view() gives the impression that this return a std::ranges::view. However, ...
  • 42.4k
1 vote

A recursive_transform Template Function with Unwrap Level for std::array Implementation in C++

The Inserter Fails on Most STL Structures In particular, std::inserter assumes that the container has a push_back member ...
  • 3,341
1 vote

A Function Applier for Applying Various Algorithms on Nested Container Things in C++

What does it do? I am trying to generalize the operation of applying a function on elements in nested container. If you say that, I would think that your ...
  • 42.4k
2 votes
Accepted

A recursive_transform Template Function with Unwrap Level for std::array Implementation in C++

It's just getting better and better! Use a constraint instead of static_assert() You can trivially turn the static_assert() you ...
  • 42.4k
1 vote

Get value from dictionary given a list of nested keys

Here is a compact and versatile way to accomplish this without extra libraries: ...
  • 119

Top 50 recent answers are included