// -*- C++ -*-
// -----------------------------------------------------------------------------------------------------
// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
// -----------------------------------------------------------------------------------------------------

/*!\file
// \brief Provides std::span from the C++20 standard library.
// \see https://en.cppreference.com/w/cpp/container/span
*/

//!\cond
#pragma once

#if __has_include(<span>)
#include <span>
#endif // __has_include(<span>)

#if !defined(__cpp_lib_span)

#include <seqan3/contrib/span/span>

#if RANGE_V3_VERSION >= 1000
namespace ranges
{
template<typename span_tp, std::size_t span_sz>
inline constexpr bool enable_borrowed_range<std::span<span_tp, span_sz>> = true;

// we follow the definition of the ranges library for enable_view:
// https://github.com/ericniebler/range-v3/blob/6103268542c27210dbc3f99f1fa0c1e348b52184/include/range/v3/range/concepts.hpp#L201
template<typename span_tp, std::size_t span_sz>
inline constexpr bool enable_view<std::span<span_tp, span_sz>> = span_sz + 1 < 2;
} // namespace ranges
#endif // RANGE_V3_VERSION >= 1000

#endif // !defined(__cpp_lib_span)
//!\endcond
