fork download
  1. #include <string>
  2.  
  3. template<typename CharT>
  4. class Format
  5. {
  6. public:
  7. typedef std::basic_string<CharT> StringT;
  8.  
  9. template< typename CharU>
  10. friend Format<CharU> format(const std::basic_string<CharU>& str,std::size_t n);
  11.  
  12. template< typename CharU>
  13. friend Format<CharU> format(const CharU* str,std::size_t n);
  14.  
  15. private:
  16. Format(const StringT& str, std::size_t firstArgNumber=0){};
  17. Format(const Format& f){};
  18. Format& operator==(const Format& f){};
  19. };
  20. //----------------------- friend format() -----------------------------------------
  21. template< typename CharT>
  22. Format<CharT> format(const std::basic_string<CharT>& str,std::size_t n=0)
  23. {
  24. return Format<CharT>(str,n);
  25. }
  26. //---------------------------------------------------------------------------------
  27. template< typename CharT>
  28. Format<CharT> format(const CharT* c_str,std::size_t n=0)
  29. {
  30. return Format<CharT>(c_str,n);
  31. }
  32. //---------------------------------------------------------------------------------
  33.  
  34. int main()
  35. {
  36. using namespace std;
  37.  
  38.  
  39. format("some");
  40.  
  41. return 0;
  42. }
  43.  
  44.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty