1  
//
1  
//
2  
// Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
2  
// Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
3  
//
3  
//
4  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
4  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  
//
6  
//
7  
// Official repository: https://github.com/boostorg/url
7  
// Official repository: https://github.com/boostorg/url
8  
//
8  
//
9  

9  

10  
#ifndef BOOST_URL_DETAIL_STRING_VIEW_HPP
10  
#ifndef BOOST_URL_DETAIL_STRING_VIEW_HPP
11  
#define BOOST_URL_DETAIL_STRING_VIEW_HPP
11  
#define BOOST_URL_DETAIL_STRING_VIEW_HPP
12  

12  

13  
#include <boost/core/detail/string_view.hpp>
13  
#include <boost/core/detail/string_view.hpp>
14  

14  

15  
namespace boost {
15  
namespace boost {
16  
namespace urls {
16  
namespace urls {
17  
namespace detail {
17  
namespace detail {
18  

18  

19  
// We use detail::to_sv(s) instead of core::string_view(s) whenever
19  
// We use detail::to_sv(s) instead of core::string_view(s) whenever
20  
// we should convert to core::string_view.
20  
// we should convert to core::string_view.
21  
// This is a workaround for GCC >=8.0 <8.4
21  
// This is a workaround for GCC >=8.0 <8.4
22  
// See: https://github.com/boostorg/url/issues/672
22  
// See: https://github.com/boostorg/url/issues/672
23  
template<class T>
23  
template<class T>
24  
BOOST_CXX14_CONSTEXPR
24  
BOOST_CXX14_CONSTEXPR
25  
core::string_view
25  
core::string_view
26  
to_sv(T const& t) noexcept
26  
to_sv(T const& t) noexcept
27  
{
27  
{
28  
    return core::string_view(t);
28  
    return core::string_view(t);
29  
}
29  
}
30  

30  

31  
} // detail
31  
} // detail
32  
} // urls
32  
} // urls
33  
} // boost
33  
} // boost
34  

34  

35  
#endif
35  
#endif