Fix circular dependencies on string hashing

This commit is contained in:
rexy712 2020-05-14 19:00:25 -07:00
parent 4e74e263c2
commit 4f65c38507
8 changed files with 113 additions and 9 deletions

View File

@ -0,0 +1,32 @@
/**
This file is a part of rexy's general purpose library
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef REXY_CX_BASIC_STRING_HASH_HPP
#define REXY_CX_BASIC_STRING_HASH_HPP
#include "string_hash.hpp"
#include "../string.hpp"
namespace rexy::cx{
template<>
struct hash<rexy::string> : public string_hash<rexy::string>{};
}
#endif

View File

@ -0,0 +1,32 @@
/**
This file is a part of rexy's general purpose library
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef REXY_CX_CX_STRING_HASH_HPP
#define REXY_CX_CX_STRING_HASH_HPP
#include "string_hash.hpp"
#include "string.hpp"
namespace rexy::cx{
template<size_t N>
struct hash<rexy::cx::string<N>> : public string_hash<rexy::cx::string<N>>{};
}
#endif

View File

@ -39,4 +39,14 @@ namespace rexy::cx{
} }
#ifdef REXY_STRING_BASE_HPP
#include "static_string_hash.hpp"
#endif
#ifdef REXY_STRING_HPP
#include "basic_string_hash.hpp"
#endif
#ifdef REXY_CX_STRING_HPP
#include "cx_string_hash.hpp"
#endif
#endif #endif

View File

@ -0,0 +1,32 @@
/**
This file is a part of rexy's general purpose library
Copyright (C) 2020 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef REXY_CX_STATIC_STRING_HASH_HPP
#define REXY_CX_STATIC_STRING_HASH_HPP
#include "string_hash.hpp"
#include "../string_base.hpp"
namespace rexy::cx{
template<>
struct hash<rexy::static_string> : public string_hash<rexy::static_string>{};
}
#endif

View File

@ -181,5 +181,8 @@ namespace rexy::cx{
} }
} }
#ifdef REXY_CX_HASH_HPP
#include "cx_string_hash.hpp"
#endif
#endif #endif

View File

@ -20,8 +20,6 @@
#define REXY_CX_STRING_HASH_HPP #define REXY_CX_STRING_HASH_HPP
#include "hash.hpp" #include "hash.hpp"
#include "../string.hpp"
#include "string.hpp"
namespace rexy::cx{ namespace rexy::cx{
@ -41,12 +39,6 @@ namespace rexy::cx{
return hash; return hash;
} }
}; };
template<>
struct hash<rexy::static_string> : public string_hash<rexy::static_string>{};
template<>
struct hash<rexy::string> : public string_hash<rexy::string>{};
template<size_t N>
struct hash<rexy::cx::string<N>> : public string_hash<rexy::cx::string<N>>{};
} }

View File

@ -32,5 +32,8 @@ namespace rexy{
#ifdef REXY_BINARY_HPP #ifdef REXY_BINARY_HPP
#include "detail/binary_string_conv.hpp" #include "detail/binary_string_conv.hpp"
#endif #endif
#ifdef REXY_CX_HASH_HPP
#include "cx/basic_string_hash.hpp"
#endif
#endif #endif

View File

@ -244,7 +244,7 @@ namespace{
} }
#ifdef REXY_CX_HASH_HPP #ifdef REXY_CX_HASH_HPP
#include "cx/string_hash.hpp" #include "cx/static_string_hash.hpp"
#endif #endif
#endif #endif