Listing 1 – implementation of the int2str_proxy template class
template< typename C , typename I > class int2str_proxy { public: typedef C char_type; typedef I int_type; public: int2str_proxy(int_type i) : m_result(stlsoft::integer_to_string(m_sz, stlsoft_num_elements(m_sz), i)) {} int2str_proxy(int2str_proxy const &rhs) : m_result(m_sz) { char_type *dest = m_sz; char_type const *src = rhs.m_result; for(; 0 != (*dest++ = *src++);) {} } operator char_type const *() const { return m_result; } private: char_type const * const m_result; char_type m_sz[21]; // Not to be implemented private: int2str_proxy &operator =(int2str_proxy const &rhs); }; template< typename C , typename I > inline int2str_proxy<C, I> int2str(I i) { return int2str_proxy<C, I>(i); }