trns1997 commented on issue #16775:
URL: https://github.com/apache/nuttx/issues/16775#issuecomment-3160301488

   I just built and tested the following using `CONFIG_CXX_STANDARD="c++20"` on 
a `XMC4800`:
   ```
   #include <nuttx/config.h>
   
   #include <cstdio>
   #include <debug.h>
   
   #include <ranges>
   #include <vector>
   #include <numeric>
   
   extern "C" int main(int argc, FAR char *argv[])
   {
       std::vector<int> v(10);
       std::iota(v.begin(), v.end(), 1); // fills with 1,2,…,10
   
       auto is_even = [](int x) { return x % 2 == 0; };
       auto square  = [](int x) { return x * x; };
   
       // Compose a view: filter evens, then square, then take first 3 results
       auto result = v
           | std::views::filter(is_even)
           | std::views::transform(square)
           | std::views::take(3);
   
       for (int x : result) {
           printf("%d\n", x);
       }
   
       return 0;
   }
   ```
   
   ### Output in picocom
   ```
   nsh> helloxx
   4
   16
   36
   ```
   
   So views and ranges seem to be working just fine, cannot guarantee that all 
C++20 features will work but this is super nice to know for all future users :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to