
On Jul 5, 2010, at 2:50 PM, Mostafa wrote:
On Mon, 05 Jul 2010 14:35:58 -0700, Marshall Clow
wrote: On Jul 5, 2010, at 2:10 PM, Mostafa wrote:
Hi all,
Is there a boost utility that will return the "correct" value_type for std containers? i.e., for:
typedef std::vector<char> const CharVector;
is there SomeBoostUtility<CharVector>::Type == char const ?
I don't know of one, but this should work:
template <class Container> bool equal_to_string ( const Container &c, const typename Container::value_type *pFirst ) { return std::equal ( c.begin (), c.end (), pFirst ); }
Thanks, I was actually looking for something that will return either a const or non-const qualified value_type for the complimentary qualified container type. Something like this:
template <typename T> struct StdContainerValue { typedef typename T::value_type Type; };
template <typename T> struct StdContainerValue<T const> { typedef typename T::value_type const Type; };
Sorry -- I completely misread your posting. -- Marshall