[ create a new paste ] login | about

Link: http://codepad.org/ihSSZRzk    [ raw code | output | fork ]

C++, pasted on Aug 12:
#include <iostream>

class logger
{
   public:
   logger() : target(std::cout) {}

   template<class T> inline
   logger& operator<<(T const& v )
   {
      target << v;
      return *this;
   }

   template<class T> inline
   logger& operator<<(T& v )
   {
      target << v;
      return *this;
   }

   private:
   ostream& target;
};

int main()
{
  logger myLog;
  myLog << "yo dawg " << 43 << "!!!";
}


Output:
1
yo dawg 43!!!


Create a new paste based on this one


Comments: