]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | /*============================================================================= |
2 | Copyright (c) 2017 Daniel James | |
3 | http://spirit.sourceforge.net/ | |
4 | ||
5 | Use, modification and distribution is subject to the Boost Software | |
6 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 | http://www.boost.org/LICENSE_1_0.txt) | |
8 | =============================================================================*/ | |
9 | #if !defined(BOOST_SPIRIT_QUICKBOOK_STRING_VIEW_HPP) | |
10 | #define BOOST_SPIRIT_QUICKBOOK_STRING_VIEW_HPP | |
11 | ||
12 | #include <boost/utility/string_view.hpp> | |
13 | ||
11fdf7f2 TL |
14 | namespace quickbook |
15 | { | |
b32b8144 FG |
16 | // boost::string_view now can't be constructed from an rvalue std::string, |
17 | // which is something that quickbook does in several places, so this wraps | |
18 | // it to allow that. | |
19 | ||
11fdf7f2 TL |
20 | struct string_view : boost::string_view |
21 | { | |
b32b8144 FG |
22 | typedef boost::string_view base; |
23 | ||
24 | string_view() : base() {} | |
25 | string_view(string_view const& x) : base(x) {} | |
26 | string_view(std::string const& x) : base(x) {} | |
27 | string_view(const char* x) : base(x) {} | |
28 | string_view(const char* x, base::size_type len) : base(x, len) {} | |
29 | ||
30 | std::string to_s() const { return std::string(begin(), end()); } | |
31 | }; | |
32 | ||
33 | typedef quickbook::string_view::const_iterator string_iterator; | |
34 | } | |
35 | ||
36 | #endif |