fork download
  1. template <typename T>
  2. std::shared_ptr<std::vector<T>> BlobPtr<T>::check(std::size_t i, std::string& msg) const
  3. {
  4. auto ret = wptr.lock();
  5. if (!ret)
  6. throw std::runtime_error("Unbound BlobPtr");
  7. if (i >= ret->size())
  8. throw std::out_of_range(msg);
  9. return ret;
  10. }
  11.  
  12. template <typename T>
  13. BlobPtr<T>& BlobPtr<T>::operator++()
  14. {
  15. check(curr, std::string("Increment past end"));
  16. ++curr;
  17. return *this;
  18. }
  19.  
  20. template <typename T>
  21. BlobPtr<T>& BlobPtr<T>::operator--()
  22. {
  23. check(curr, "Decrement before begin");
  24. --curr;
  25. return *this;
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:6: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
 std::shared_ptr<std::vector<T>> BlobPtr<T>::check(std::size_t i, std::string& msg) const
      ^~~~~~~~~~
prog.cpp:13:1: error: ‘BlobPtr’ does not name a type
 BlobPtr<T>& BlobPtr<T>::operator++()
 ^~~~~~~
prog.cpp:21:1: error: ‘BlobPtr’ does not name a type
 BlobPtr<T>& BlobPtr<T>::operator--()
 ^~~~~~~
stdout
Standard output is empty