proconlib

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub anqooqie/proconlib

:heavy_check_mark: Check whether T is a range type (tools/is_range.hpp)

template <typename T>
struct is_range {
  static constexpr bool value;
};

template <typename T>
inline constexpr bool is_range_v = is_range<T>::value;

If an instance of T can be passed to std::begin and std::end, tools::is_range<T>::value is true. Otherwise, it is false.

Constraints

Time Complexity

License

Author

Required by

Verified with

Code

#ifndef TOOLS_IS_RANGE_HPP
#define TOOLS_IS_RANGE_HPP

#include <type_traits>
#include <iterator>
#include <utility>

namespace tools {
  template <typename T, typename = ::std::void_t<>>
  struct is_range : ::std::false_type {};

  template <typename T>
  struct is_range<T, ::std::void_t<decltype(::std::begin(::std::declval<T>()), ::std::end(::std::declval<T>()))>> : ::std::true_type {};

  template <typename T>
  inline constexpr bool is_range_v = ::tools::is_range<T>::value;
}

#endif
#line 1 "tools/is_range.hpp"



#include <type_traits>
#include <iterator>
#include <utility>

namespace tools {
  template <typename T, typename = ::std::void_t<>>
  struct is_range : ::std::false_type {};

  template <typename T>
  struct is_range<T, ::std::void_t<decltype(::std::begin(::std::declval<T>()), ::std::end(::std::declval<T>()))>> : ::std::true_type {};

  template <typename T>
  inline constexpr bool is_range_v = ::tools::is_range<T>::value;
}


Back to top page