Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Assembly
C
Carbon
C++ (Circle)
CIRCT
Clean
CMake
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Crystal
C#
CUDA C++
D
Dart
Erlang
Fortran
F#
Go
Haskell
HLSL
ispc
Java
Kotlin
LLVM IR
Nim
OCaml
OpenCL C
Pascal
Pony
Python
Ruby
Rust
Scala
Solidity
Swift
Toit
TypeScript Native
Visual Basic
Zig
cppx source #1
Output
Compile to binary
Execute the code
Intel asm syntax
Demangle identifiers
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Compiler
CppCon 2017
CppCon 2018
p1240r1
p1240r2 trunk
p2320 trunk
Options
Source code
#include <vector> #include <iostream> using namespace std; #include <range/v3/view/filter.hpp> using namespace ranges; // Example 1.1.3.c void example_1_1_3_c() { vector<int> ints{0, 1, 2, 3, 4, 5}; auto even = [](int i) { return !(i % 2); }; auto view = ints | view::filter(even); cout << *ranges::begin(view); // ok ints.push_back(6); // A: invalidates view cout << *ranges::begin(view); // ERROR, view was invalidated // by ‘ints.push_back’ (line A) }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
About the author
Changelog
Version tree