mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-01-09 00:50:17 +00:00
add static_assert and useful member funcs
This commit is contained in:
parent
f83a8b450e
commit
59588e3a10
@ -16,6 +16,7 @@ namespace detail
|
|||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct location
|
struct location
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_same<char, typename Container::value_type>::value,"");
|
||||||
using const_iterator = typename Container::const_iterator;
|
using const_iterator = typename Container::const_iterator;
|
||||||
|
|
||||||
location(Container cont)
|
location(Container cont)
|
||||||
@ -39,6 +40,7 @@ struct location
|
|||||||
template<typename Container>
|
template<typename Container>
|
||||||
struct region
|
struct region
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_same<char, typename Container::value_type>::value,"");
|
||||||
using const_iterator = typename Container::const_iterator;
|
using const_iterator = typename Container::const_iterator;
|
||||||
|
|
||||||
region(const location<Container>& loc)
|
region(const location<Container>& loc)
|
||||||
@ -65,6 +67,9 @@ struct region
|
|||||||
region& operator=(region&&) = default;
|
region& operator=(region&&) = default;
|
||||||
~region() = default;
|
~region() = default;
|
||||||
|
|
||||||
|
std::string str() const {return std::string(first, last);}
|
||||||
|
std::size_t size() const {return std::distance(first, last);}
|
||||||
|
|
||||||
const_iterator begin, first, last, end;
|
const_iterator begin, first, last, end;
|
||||||
std::shared_ptr<const Container> source;
|
std::shared_ptr<const Container> source;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user