fork(2) download
  1. #include <vector>
  2. #include <initializer_list>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. template<class Container>
  7. class SequenceContainerWrapper
  8. {
  9. Container cont;
  10. public:
  11. using value_type = typename Container::value_type;
  12. using reference = typename Container::reference;
  13. using size_type = typename Container::size_type;
  14. SequenceContainerWrapper(initializer_list<value_type> init) : cont(init) {}
  15. reference operator[] (size_type n) {return cont[n];}
  16. // lots of other code that does nothing but wrapping
  17. };
  18.  
  19. int main()
  20. {
  21. SequenceContainerWrapper<vector<int>> vec({1,2,3,4});
  22. cout << vec[2] << '\n';
  23. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
3