Do not accept the size type of the container (or anything else printed inside).
Today?
The best solution at the moment is to use:
std::vector<T>::size_type
Where T is your type. For example:
std::vector<std::string>::size_type i ;
std::vector<int>::size_type j ;
std::vector<std::vector<double> >::size_type k ;
(Using typedef can help make it better to read)
The same goes for iterators and all other types inside STL containers.
After C ++ 0x?
, auto. :
void doSomething(const std::vector<double> & p_aData)
{
std::vector<double>::size_type i = p_aData.size() ;
auto j = p_aData.size() ;
decltype(p_aData.size()) k;
}
: JF
, - , , , unsigned int? - JF
, STL: - .
- , STL. :
typedef std::vector<int>::size_type VIntSize ;
VIntSize getIndexOfSomeItem(const std::vector<int> p_aInt)
{
return
}
, , static_cast, , , ( "char", " , 256" [ ]).
, .