diff --git a/src/string.h b/src/string.h index 3f5bfb80..055c1fc9 100644 --- a/src/string.h +++ b/src/string.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -180,6 +181,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for string. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const string& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) diff --git a/src/u16string.h b/src/u16string.h index a7ca2b57..138fa916 100644 --- a/src/u16string.h +++ b/src/u16string.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -180,6 +181,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for u16string. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const u16string& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) diff --git a/src/u32string.h b/src/u32string.h index 5890f1c7..8280fbba 100644 --- a/src/u32string.h +++ b/src/u32string.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -180,6 +181,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for u32string. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const u32string& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT) diff --git a/src/wstring.h b/src/wstring.h index 8019a29f..94bebc6b 100644 --- a/src/wstring.h +++ b/src/wstring.h @@ -33,6 +33,7 @@ SOFTWARE. #include "platform.h" #include "basic_string.h" +#include "hash.h" #if defined(ETL_COMPILER_MICROSOFT) #undef min @@ -181,6 +182,22 @@ namespace etl value_type buffer[MAX_SIZE + 1]; }; + + //*************************************************************************** + /// Specialisation for wstring. + ///\ingroup hash + //*************************************************************************** + template <> + struct hash + { + size_t operator ()(const wstring& s) const + { + uint8_t* p_begin = &s[0]; + uint8_t* p_end = &s[s.size()]; + + return etl::__private_hash__::generic_hash(p_begin, p_end); + } + }; } #if defined(ETL_COMPILER_MICROSOFT)