mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 21:44:43 -04:00
Add commit 43aab01 of BenHanson/lexertl14 from github
This commit is contained in:
committed by
Luis Ángel San Martín
parent
c4f792bd40
commit
d3de52ca82
45
YACReaderLibrary/lexertl/char_traits.hpp
Normal file
45
YACReaderLibrary/lexertl/char_traits.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
// char_traits.hpp
|
||||
// Copyright (c) 2005-2018 Ben Hanson (http://www.benhanson.net/)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LEXERTL_CHAR_TRAITS_HPP
|
||||
#define LEXERTL_CHAR_TRAITS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace lexertl
|
||||
{
|
||||
template<typename ch_type>
|
||||
struct basic_char_traits
|
||||
{
|
||||
using char_type = ch_type;
|
||||
using index_type = ch_type;
|
||||
|
||||
static index_type max_val()
|
||||
{
|
||||
const std::uint32_t max_ = 0x10ffff;
|
||||
|
||||
return sizeof(char_type) > 2 ?
|
||||
max_ : (max_ & 0xffff);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct basic_char_traits<char>
|
||||
{
|
||||
using char_type = char;
|
||||
using index_type = unsigned char;
|
||||
|
||||
static index_type max_val()
|
||||
{
|
||||
// Prevent annoying warning (VC++)
|
||||
index_type zero_ = 0;
|
||||
|
||||
return ~zero_;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user