// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Copyright (C) Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// This file incorporates work covered by the following copyright and permission
// notice:
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//

#ifndef _ONEDPL_RANGES
#define _ONEDPL_RANGES

#include "oneapi/dpl/internal/common_config.h"

// TODO: Figure out the order of headers and add standard header version/ciso646 for library version macros.
#if defined(_GLIBCXX_RELEASE)
#    define _ONEDPL_CXX_STANDARD_LIBRARY_CHECK (_GLIBCXX_RELEASE >= 8 && __GLIBCXX__ >= 20180502)
#elif defined(_LIBCPP_VERSION)
#    define _ONEDPL_CXX_STANDARD_LIBRARY_CHECK (_LIBCPP_VERSION >= 7000)
#else
#    define _ONEDPL_CXX_STANDARD_LIBRARY_CHECK 1
#endif

static_assert(_ONEDPL_CXX_STANDARD_LIBRARY_CHECK,
              "The use of the range-based API requires the C++ standard libraries coming "
              "with GCC 8.1 (or higher) or Clang 7 (or higher)");

#include "oneapi/dpl/pstl/onedpl_config.h"
#include "oneapi/dpl/pstl/ranges_defs.h"

#if !_ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_algorithm_ranges_defs.h"
#    define _ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED 1
#endif // !_ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED

#if !_ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_numeric_ranges_defs.h"
#    define _ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED 1
#endif // !_ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED

#if _ONEDPL_EXECUTION_POLICIES_DEFINED
// If <execution> has already been included, pull in implementations
#    include "oneapi/dpl/pstl/glue_algorithm_ranges_impl.h"
#    include "oneapi/dpl/pstl/glue_numeric_ranges_impl.h"
#endif // _ONEDPL_EXECUTION_POLICIES_DEFINED

namespace dpl = oneapi::dpl;

#endif // _ONEDPL_RANGES
