mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix coding-stype
This commit is contained in:
parent
2012838899
commit
df3023db30
196 changed files with 2510 additions and 3945 deletions
|
@ -9,21 +9,24 @@
|
|||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename Elem, typename IntType>
|
||||
inline SPROUT_CONSTEXPR Elem int_to_char(IntType val, int base){
|
||||
inline SPROUT_CONSTEXPR Elem
|
||||
int_to_char(IntType val, int base) {
|
||||
return val >= 0 && val < 10 ? static_cast<Elem>('0') + val
|
||||
: val >= 10 && val < static_cast<IntType>(base) ? static_cast<Elem>('a') + (val - 10)
|
||||
: throw std::invalid_argument("value out of bounds")
|
||||
;
|
||||
}
|
||||
template<typename Elem, typename IntType>
|
||||
inline SPROUT_CONSTEXPR Elem int_to_char(IntType val){
|
||||
inline SPROUT_CONSTEXPR Elem
|
||||
int_to_char(IntType val) {
|
||||
return val >= 0 && val < 10 ? static_cast<Elem>('0') + val
|
||||
: throw std::invalid_argument("value out of bounds")
|
||||
;
|
||||
}
|
||||
|
||||
template<typename IntType, typename Elem>
|
||||
inline SPROUT_CONSTEXPR IntType char_to_int(Elem c, int base){
|
||||
inline SPROUT_CONSTEXPR IntType
|
||||
char_to_int(Elem c, int base) {
|
||||
return sprout::ascii::isdigit(c) && c - static_cast<Elem>('0') < base ? c - static_cast<Elem>('0')
|
||||
: sprout::ascii::islower(c) && c - static_cast<Elem>('a') + 10 < base ? c - static_cast<Elem>('a') + 10
|
||||
: sprout::ascii::isupper(c) && c - static_cast<Elem>('A') + 10 < base ? c - static_cast<Elem>('A') + 10
|
||||
|
@ -31,7 +34,8 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename IntType, typename Elem>
|
||||
inline SPROUT_CONSTEXPR IntType char_to_int(Elem c){
|
||||
inline SPROUT_CONSTEXPR IntType
|
||||
char_to_int(Elem c) {
|
||||
return sprout::ascii::isdigit(c) ? c - static_cast<Elem>('0')
|
||||
: static_cast<IntType>(-1)
|
||||
;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue