99#include < string>
1010#include < string_view>
1111
12- template <usize data_size >
12+ template <usize DataSize >
1313struct StaticString {
1414private:
15- std::array<char , data_size > m_data;
15+ std::array<char , DataSize > m_data;
1616
1717 constexpr StaticString () : m_data{} { }
1818
1919public:
2020 constexpr StaticString (const char (&chars // NOLINT(modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
21- )[data_size ]) {
22- std::copy (chars, chars + data_size , begin ());
21+ )[DataSize ]) {
22+ std::copy (chars, chars + DataSize , begin ());
2323 }
2424
2525 [[nodiscard]] constexpr usize size () const {
26- return data_size - 1 ;
26+ return DataSize - 1 ;
2727 }
2828
2929 [[nodiscard]] constexpr usize length () const {
@@ -80,8 +80,8 @@ struct StaticString {
8080 return m_data.back ();
8181 }
8282
83- template <usize other_data_size , typename Result = StaticString<data_size + other_data_size - 1 >>
84- [[nodiscard]] constexpr Result operator +(const StaticString<other_data_size >& other) const {
83+ template <usize OtherDataSize , typename Result = StaticString<DataSize + OtherDataSize - 1 >>
84+ [[nodiscard]] constexpr Result operator +(const StaticString<OtherDataSize >& other) const {
8585 auto concatenated = Result{};
8686 std::ranges::copy (*this , concatenated.begin ());
8787 std::ranges::copy (other, concatenated.begin () + size ());
@@ -101,46 +101,46 @@ struct StaticString {
101101 return std::string_view{ cbegin (), cend () };
102102 }
103103
104- template <usize other_data_size >
104+ template <usize OtherDataSize >
105105 [[nodiscard]] friend constexpr bool
106- operator ==(const StaticString<data_size >& self, const StaticString<other_data_size >& other) {
106+ operator ==(const StaticString<DataSize >& self, const StaticString<OtherDataSize >& other) {
107107 return self.m_data == other.m_data ;
108108 }
109109
110- template <usize other_data_size >
110+ template <usize OtherDataSize >
111111 [[nodiscard]] friend constexpr bool
112- operator !=(const StaticString<data_size >& self, const StaticString<other_data_size >& other) {
112+ operator !=(const StaticString<DataSize >& self, const StaticString<OtherDataSize >& other) {
113113 return not (self == other);
114114 }
115115
116- template <usize first_data_size , usize... other_data_sizes >
116+ template <usize FirstDataSize , usize... OtherDataSizes >
117117 [[nodiscard]] constexpr auto
118- join (const StaticString<first_data_size >& first, const StaticString<other_data_sizes >&... rest) const {
118+ join (const StaticString<FirstDataSize >& first, const StaticString<OtherDataSizes >&... rest) const {
119119 if constexpr (sizeof ...(rest) == 0 ) {
120120 return first;
121121 } else {
122122 return first + *this + join (rest...);
123123 }
124124 }
125125
126- [[nodiscard]] constexpr operator const char *() const {
126+ [[nodiscard]] constexpr operator const char *() const { // NOLINT(google-explicit-constructor)
127127 return c_str ();
128128 }
129129
130- [[nodiscard]] constexpr operator std::string_view () const {
130+ [[nodiscard]] constexpr operator std::string_view () const { // NOLINT(google-explicit-constructor)
131131 return string_view ();
132132 }
133133
134- [[nodiscard]] operator std::string () const {
134+ [[nodiscard]] operator std::string () const { // NOLINT(google-explicit-constructor)
135135 return string ();
136136 }
137137
138- [[nodiscard]] operator std::filesystem::path () const {
138+ [[nodiscard]] operator std::filesystem::path () const { // NOLINT(google-explicit-constructor)
139139 return string ();
140140 }
141141
142142 // make all template instantiations of this template a friend
143- template <usize other_data_size >
143+ template <usize OtherDataSize >
144144 friend struct StaticString ;
145145};
146146
0 commit comments