Template function to display container

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex Vinokur

    Template function to display container

    I would like to define template function to display any container.
    Something like (but syntax below is illegal because of S<T>):


    template<typena me S, typename T>
    void display (std::ostream& o_stream, const S<T>& i_data, const
    std::string& i_delim = " ")
    {
    o_stream << std::flush;
    std::copy (i_data.begin() , i_data.end(),
    std::ostream_it erator<T(o_stre am, i_delim));
    o_stream << std::endl << std::flush;
    }

    Is there any solution?

    Alex Vinokur
    email: alex DOT vinokur AT gmail DOT com






Working...