File indexing completed on 2025-01-18 09:53:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_URL_GRAMMAR_DETAIL_RECYCLED_HPP
0011 #define BOOST_URL_GRAMMAR_DETAIL_RECYCLED_HPP
0012
0013 #include <utility>
0014
0015 namespace boost {
0016 namespace urls {
0017 namespace grammar {
0018 namespace detail {
0019
0020 template<
0021 std::size_t Size,
0022 std::size_t Align>
0023 struct aligned_storage_impl
0024 {
0025 void* addr() noexcept
0026 {
0027 return buf_;
0028 }
0029
0030 void const* addr() const noexcept
0031 {
0032 return buf_;
0033 }
0034
0035 private:
0036 alignas(Align)
0037 unsigned char buf_[Size];
0038 };
0039
0040 constexpr
0041 std::size_t
0042 nearest_pow2(
0043 std::size_t x,
0044 std::size_t f = 0) noexcept
0045 {
0046 return
0047 (f <= (std::size_t(-1)/2))
0048 ? ( x <= f
0049 ? f
0050 : nearest_pow2(x, 2 * f))
0051 : x;
0052 }
0053
0054
0055
0056 BOOST_URL_DECL
0057 void
0058 recycled_add_impl(
0059 std::size_t) noexcept;
0060
0061 BOOST_URL_DECL
0062 void
0063 recycled_remove_impl(
0064 std::size_t) noexcept;
0065
0066 #ifdef BOOST_URL_REPORT
0067
0068 inline
0069 void
0070 recycled_add(
0071 std::size_t n) noexcept
0072 {
0073 recycled_add_impl(n);
0074 }
0075
0076 inline
0077 void
0078 recycled_remove(
0079 std::size_t n) noexcept
0080 {
0081 recycled_remove_impl(n);
0082 }
0083
0084 #else
0085
0086 inline void recycled_add(
0087 std::size_t) noexcept
0088 {
0089 }
0090 inline void recycled_remove(
0091 std::size_t) noexcept
0092 {
0093 }
0094
0095 #endif
0096
0097 }
0098 }
0099 }
0100 }
0101
0102 #endif