Topic: an argument-dependent accessor to traits_type
Author: krixel@qed.pl ("Krzysztof elechowski")
Date: Tue, 11 Jul 2006 15:05:06 GMT Raw View
Hello,
I find the following argument-dependent accessor extremely useful. I wonder
why the Standard did not provide it. Rationale: using
std::ifstream::traits_type explicitly in user code is error prone: the
compiler cannot detect the error when the argument changes from a reference
to an fstream to a reference to a std::wifstream during redesign and the
std::fstream::traits_type used to interpret the input is left unchanged.
Chris
template<class P_T> static inline typename P_T::traits_type
use_traits(P_T const &) { return P_T::traits_type(); }
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]