yo/stl/examples/backinserter.cc
raw| 1 | #include <iostream> |
| 2 | #include <algorithm> |
| 3 | #include <iterator> |
| 4 | using namespace std; |
| 5 | |
| 6 | class Insertable |
| 7 | { |
| 8 | public: |
| 9 | using value_type = int; |
| 10 | using const_reference = int const &; |
| 11 | |
| 12 | void push_back(int const &) |
| 13 | {} |
| 14 | }; |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | int arr[] = {1}; |
| 19 | Insertable insertable; |
| 20 | |
| 21 | copy(arr, arr + 1, back_inserter(insertable)); |
| 22 | } |