fork download
  1. #include <sstream>
  2.  
  3. class Uri
  4. {
  5. };
  6.  
  7. template<class TData, class TStr>
  8. inline TData fromString(const TStr &str)
  9. {
  10. std::stringstream oss;
  11. oss << str;
  12. TData t;
  13. oss >> t;
  14. return t;
  15. }
  16.  
  17. class StringBuilder
  18. {
  19. public:
  20. inline operator const std::string () const
  21. {
  22. return oss.str();
  23. }
  24.  
  25. private:
  26. std::ostringstream oss;
  27. };
  28.  
  29. namespace LibFacebookCpp
  30. {
  31.  
  32. struct PagingInfo
  33. {
  34. PagingInfo(unsigned int offset_, unsigned int limit_) : offset(offset_), limit(limit_) { }
  35.  
  36. bool IsValid() const { return 0 != limit; }
  37. void GetUri(Uri *uri) const
  38. {
  39. uri->query_params["limit"] = StringBuilder() << offset;
  40. uri->query_params["offset"] = StringBuilder() << limit;
  41. }
  42.  
  43. unsigned int offset, limit;
  44. };
  45.  
  46. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'void LibFacebookCpp::PagingInfo::GetUri(Uri*) const':
prog.cpp:39:10: error: 'class Uri' has no member named 'query_params'
prog.cpp:39:53: error: no match for 'operator<<' in 'StringBuilder() << ((const LibFacebookCpp::PagingInfo*)this)->LibFacebookCpp::PagingInfo::offset'
prog.cpp:40:10: error: 'class Uri' has no member named 'query_params'
prog.cpp:40:54: error: no match for 'operator<<' in 'StringBuilder() << ((const LibFacebookCpp::PagingInfo*)this)->LibFacebookCpp::PagingInfo::limit'
stdout
Standard output is empty