1// Copyright (C) 2019 T. Zachary Laine
2//
3// Distributed under the Boost Software License, Version 1.0. (See
4// accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6#ifndef BOOST_STL_INTERFACES_VIEW_TESTING_HPP
7#define BOOST_STL_INTERFACES_VIEW_TESTING_HPP
8
9#include <boost/stl_interfaces/view_interface.hpp>
10
11
12template<
13 typename Iterator,
14 typename Sentinel,
15 boost::stl_interfaces::element_layout Contiguity>
16struct subrange
17 : boost::stl_interfaces::
18 view_interface<subrange<Iterator, Sentinel, Contiguity>, Contiguity>
19{
20 subrange() = default;
21 constexpr subrange(Iterator it, Sentinel s) : first_(it), last_(s) {}
22
23 constexpr auto begin() const { return first_; }
24 constexpr auto end() const { return last_; }
25
26private:
27 Iterator first_;
28 Sentinel last_;
29};
30
31template<
32 boost::stl_interfaces::element_layout Contiguity,
33 typename Iterator,
34 typename Sentinel>
35auto range(Iterator i, Sentinel s)
36{
37 return subrange<Iterator, Sentinel, Contiguity>(i, s);
38}
39
40#endif
41

source code of boost/libs/stl_interfaces/test/view_tests.hpp