Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 76de097

Browse files
committed
Move inline_string and basic_string template helpers out
of a template_helpers.hpp. The template_helpers.hpp file should not have any dependencies on libpmemobj-cpp headers.
1 parent c68618e commit 76de097

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

include/libpmemobj++/detail/template_helpers.hpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
#include <type_traits>
1313

14-
#include <libpmemobj++/container/basic_string.hpp>
15-
#include <libpmemobj++/experimental/inline_string.hpp>
16-
1714
namespace pmem
1815
{
1916

@@ -47,31 +44,6 @@ using is_transparent = typename Compare::is_transparent;
4744
template <typename Compare>
4845
using has_is_transparent = detail::supports<Compare, is_transparent>;
4946

50-
/* Check if type is pmem::obj::basic_inline_string */
51-
template <typename>
52-
struct is_inline_string : std::false_type {
53-
};
54-
55-
template <typename CharT, typename Traits>
56-
struct is_inline_string<obj::experimental::basic_inline_string<CharT, Traits>>
57-
: std::true_type {
58-
};
59-
60-
/* Check if type is pmem::obj::basic_string or
61-
* pmem::obj::basic_inline_string */
62-
template <typename>
63-
struct is_string : std::false_type {
64-
};
65-
66-
template <typename CharT, typename Traits>
67-
struct is_string<obj::basic_string<CharT, Traits>> : std::true_type {
68-
};
69-
70-
template <typename CharT, typename Traits>
71-
struct is_string<obj::experimental::basic_inline_string<CharT, Traits>>
72-
: std::true_type {
73-
};
74-
7547
} /* namespace detail */
7648

7749
} /* namespace pmem */

include/libpmemobj++/experimental/inline_string.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,20 @@ struct total_sizeof<basic_inline_string<CharT, Traits>> {
305305
};
306306
} /* namespace experimental */
307307
} /* namespace obj */
308+
309+
namespace detail
310+
{
311+
/* Check if type is pmem::obj::basic_inline_string */
312+
template <typename>
313+
struct is_inline_string : std::false_type {
314+
};
315+
316+
template <typename CharT, typename Traits>
317+
struct is_inline_string<obj::experimental::basic_inline_string<CharT, Traits>>
318+
: std::true_type {
319+
};
320+
} /* namespace detail */
321+
308322
} /* namespace pmem */
309323

310324
#endif /* LIBPMEMOBJ_CPP_INLINE_STRING_HPP */

include/libpmemobj++/experimental/radix_tree.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,6 +3199,21 @@ swap(radix_tree<Key, Value, BytesView> &lhs,
31993199

32003200
namespace detail
32013201
{
3202+
/* Check if type is pmem::obj::basic_string or
3203+
* pmem::obj::basic_inline_string */
3204+
template <typename>
3205+
struct is_string : std::false_type {
3206+
};
3207+
3208+
template <typename CharT, typename Traits>
3209+
struct is_string<obj::basic_string<CharT, Traits>> : std::true_type {
3210+
};
3211+
3212+
template <typename CharT, typename Traits>
3213+
struct is_string<obj::experimental::basic_inline_string<CharT, Traits>>
3214+
: std::true_type {
3215+
};
3216+
32023217
template <typename T>
32033218
struct bytes_view<T, typename std::enable_if<is_string<T>::value>::type> {
32043219
using CharT = typename T::value_type;

0 commit comments

Comments
 (0)