[ create a new paste ] login | about

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

hendrix.john64@gmail.com - C++, pasted on Jul 27:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

class Hokey
{
public:
    explicit Hokey(int i): i_(i) { }

    template<typename T>
    T& render(T& t) const { t = static_cast<T>(i_); return t; }

    string& render(string& s) const {
        ostringstream out;
        out << i_;
//        s = out.str();
        return s;
    }
private:
    unsigned i_;
};

int main()
{
    Hokey h(1);
    string str;
    h.render(str);
    cout << "str = " << str << endl;
    return 0;
}


Output:
1
str = 


Create a new paste based on this one


Comments: