VectorConvert.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include <istream>
00004 #include <ostream>
00005 #include <vector>
00006 #include <string>
00007 #include <coil/stringutil.h>
00008 
00009 template<typename T>
00010 std::istream& operator>>(std::istream& is, std::vector<T>& v)
00011 {
00012   std::string s;
00013   std::vector<std::string> sv;
00014   is >> s;
00015   sv = coil::split(s ,",");
00016   v.resize(sv.size());
00017   for (int i(0), len(sv.size()); i < len; ++i)
00018     {
00019       T tv;
00020       if (coil::stringTo(tv, sv[i].c_str()))
00021         {
00022           v[i] = tv;
00023         }
00024     }
00025   return is;
00026 }


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:39