2222
2323// =============================================================
2424#include < string>
25+ #include < vector>
2526// #include <initializer_list>
2627
2728
@@ -31,7 +32,7 @@ template<
3132 class CharT ,
3233 class TraitsT = std::char_traits<CharT>,
3334 class AllocatorT = std::allocator<CharT>
34- > class CppStringT ; // !< The templated base class. Use its specializations instead!
35+ > class CppStringT ; // !< The templated base class. Use its belowing specializations instead!
3536
3637using CppString = CppStringT<char >; // !< Specialization of basic class with template argument 'char'
3738using CppWString = CppStringT<wchar_t >; // !< Specialization of basic class with template argument 'wchar_t'
@@ -62,7 +63,7 @@ template<class CharT, class TraitsT, class AllocatorT>
6263class CppStringT : public std ::basic_string<CharT>
6364{
6465public:
65- // --- Wrappers ----------------------------------------
66+ // === Wrappers ========================================
6667 using MyBaseClass = std::basic_string<CharT>;
6768
6869 using traits_type = MyBaseClass::traits_type;
@@ -80,7 +81,7 @@ class CppStringT : public std::basic_string<CharT>
8081 using const_reverse_iterator = MyBaseClass::const_reverse_iterator;
8182
8283
83- // --- Constructors ------------------------------------
84+ // === Constructors ====================================
8485 inline CppStringT () : MyBaseClass() {}
8586 inline CppStringT (const CppStringT& other) : MyBaseClass(other) {}
8687 inline CppStringT (const CppStringT& other, const AllocatorT& alloc) : MyBaseClass(other, alloc){}
@@ -103,12 +104,21 @@ class CppStringT : public std::basic_string<CharT>
103104 CppStringT (const StringViewLike& svl, size_type pos, size_type n) : MyBaseClass(svl, pos, n) {}
104105
105106
106- // --- Methods -----------------------------------------
107+ // === Methods =========================================
108+
109+ // --- is_punctuation ----------------------------------
110+ /* * \brief Returns true if a character belongs to ASCII punctuation set. */
111+ inline const bool is_punctuation (const value_type ch) noexcept
112+ {
113+ return _ASCII_PUNCT_DATA.contains (ch);
114+ }
107115
108116
109117protected:
110118
111119
112120private:
121+ // === DATA ============================================
122+ static inline constexpr std::vector<value_type> _ASCII_PUNCT_DATA{ ' !' , ' ,' , ' .' , ' :' , ' ;' , ' ?' };
113123
114124};
0 commit comments