string_fwd.hpp (2025B)
1 #ifndef _C4_STD_STRING_FWD_HPP_ 2 #define _C4_STD_STRING_FWD_HPP_ 3 4 /** @file string_fwd.hpp */ 5 6 #ifndef DOXYGEN 7 8 #ifndef C4CORE_SINGLE_HEADER 9 #include "c4/substr_fwd.hpp" 10 #endif 11 12 #include <cstddef> 13 14 // forward declarations for std::string 15 #if defined(__GLIBCXX__) || defined(__GLIBCPP__) 16 #include <bits/stringfwd.h> // use the fwd header in glibcxx 17 #elif defined(_LIBCPP_VERSION) || defined(__APPLE_CC__) 18 #include <iosfwd> // use the fwd header in stdlibc++ 19 #elif defined(_MSC_VER) 20 #include "c4/error.hpp" 21 //! @todo is there a fwd header in msvc? 22 namespace std { 23 C4_SUPPRESS_WARNING_MSVC_WITH_PUSH(4643) // Forward declaring 'char_traits' in namespace std is not permitted by the C++ Standard. 24 template<typename> struct char_traits; 25 template<typename> class allocator; 26 template<typename _CharT, typename _Traits, typename _Alloc> class basic_string; 27 using string = basic_string<char, char_traits<char>, allocator<char>>; 28 C4_SUPPRESS_WARNING_MSVC_POP 29 } /* namespace std */ 30 #else 31 #error "unknown standard library" 32 #endif 33 34 namespace c4 { 35 36 C4_ALWAYS_INLINE c4::substr to_substr(std::string &s) noexcept; 37 C4_ALWAYS_INLINE c4::csubstr to_csubstr(std::string const& s) noexcept; 38 39 bool operator== (c4::csubstr ss, std::string const& s); 40 bool operator!= (c4::csubstr ss, std::string const& s); 41 bool operator>= (c4::csubstr ss, std::string const& s); 42 bool operator> (c4::csubstr ss, std::string const& s); 43 bool operator<= (c4::csubstr ss, std::string const& s); 44 bool operator< (c4::csubstr ss, std::string const& s); 45 46 bool operator== (std::string const& s, c4::csubstr ss); 47 bool operator!= (std::string const& s, c4::csubstr ss); 48 bool operator>= (std::string const& s, c4::csubstr ss); 49 bool operator> (std::string const& s, c4::csubstr ss); 50 bool operator<= (std::string const& s, c4::csubstr ss); 51 bool operator< (std::string const& s, c4::csubstr ss); 52 53 size_t to_chars(c4::substr buf, std::string const& s); 54 bool from_chars(c4::csubstr buf, std::string * s); 55 56 } // namespace c4 57 58 #endif // DOXYGEN 59 #endif // _C4_STD_STRING_FWD_HPP_