Do not use variable names ending on underscore for input variables and simpler warning suppression for generic_stringize example

This commit is contained in:
Antony Polukhin 2017-09-26 22:29:11 +03:00
parent a0b5e8415d
commit 398b451036
2 changed files with 8 additions and 8 deletions

View File

@ -55,7 +55,7 @@ int main() {
boost::tuple<char, int, char, int> decim('-', 10, 'e', 5); boost::tuple<char, int, char, int> decim('-', 10, 'e', 5);
assert(stringize(decim) == "-10e5"); assert(stringize(decim) == "-10e5");
std::pair<short, std::string> value_and_type(270, "Kelvin"); std::pair<int, std::string> value_and_type(270, "Kelvin");
assert(stringize(value_and_type) == "270Kelvin"); assert(stringize(value_and_type) == "270Kelvin");
} }

View File

@ -200,18 +200,18 @@ namespace boost {
} }
#endif #endif
bool shl_char_array(CharT const* str_) BOOST_NOEXCEPT { bool shl_char_array(CharT const* str_value) BOOST_NOEXCEPT {
start = str_; start = str_value;
finish = start + Traits::length(str_); finish = start + Traits::length(str_value);
return true; return true;
} }
template <class T> template <class T>
bool shl_char_array(T const* str_) { bool shl_char_array(T const* str_value) {
BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)), BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)),
"boost::lexical_cast does not support narrowing of char types." "boost::lexical_cast does not support narrowing of char types."
"Use boost::locale instead" ); "Use boost::locale instead" );
return shl_input_streamable(str_); return shl_input_streamable(str_value);
} }
bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT { bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT {
@ -424,8 +424,8 @@ namespace boost {
bool operator<<(unsigned char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); } bool operator<<(unsigned char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); }
bool operator<<(signed char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); } bool operator<<(signed char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); }
bool operator<<(signed char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); } bool operator<<(signed char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); }
bool operator<<(char const* str_) { return shl_char_array(str_); } bool operator<<(char const* str_value) { return shl_char_array(str_value); }
bool operator<<(char* str_) { return shl_char_array(str_); } bool operator<<(char* str_value) { return shl_char_array(str_value); }
bool operator<<(short n) { return shl_signed(n); } bool operator<<(short n) { return shl_signed(n); }
bool operator<<(int n) { return shl_signed(n); } bool operator<<(int n) { return shl_signed(n); }
bool operator<<(long n) { return shl_signed(n); } bool operator<<(long n) { return shl_signed(n); }