#ifndef CONST_STRING_HPP_ #define CONST_STRING_HPP_ #include template< class Type > class const_string { public: const_string( const Type *begin , const Type *end ) : m_begin( begin ) , m_size( end - begin ) { } template< std::size_t N > constexpr const_string( const Type (&str)[ N ] ) : m_begin( str ) , m_size( N - 1 ) { } constexpr std::size_t size() { return m_size; } constexpr Type operator[]( size_t index ) { return m_begin[ index ]; } private: const Type *m_begin; const std::size_t m_size; }; #endif