library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub kk2a/library

:heavy_check_mark: type_traits/container_traits.hpp

Required by

Verified with

Code

#ifndef KK2_TYPE_TRAITS_CONTAINER_TRAITS_HPP
#define KK2_TYPE_TRAITS_CONTAINER_TRAITS_HPP 1

#pragma once // oj-verify

#include <array>
#include <deque>
#include <list>
#include <string>
#include <type_traits>
#include <vector>

namespace kk2 {

template <typename T> struct is_vector : std::false_type {};
template <typename T, typename Alloc> struct is_vector<std::vector<T, Alloc>> : std::true_type {};

// コンテナかどうかを判定するtraits
template <typename T> struct is_container : std::false_type {};

// 基本的なコンテナ型の特殊化
template <typename T, typename Alloc> struct is_container<std::vector<T, Alloc>> : std::true_type {
};

template <typename CharT, typename Traits, typename Alloc>
struct is_container<std::basic_string<CharT, Traits, Alloc>> : std::true_type {};

template <typename T, std::size_t N> struct is_container<std::array<T, N>> : std::true_type {};

template <typename T, typename Alloc> struct is_container<std::deque<T, Alloc>> : std::true_type {};

template <typename T, typename Alloc> struct is_container<std::list<T, Alloc>> : std::true_type {};

// SFINAEでコンテナを判定するためのヘルパー
template <typename T> using is_container_t =
    typename std::enable_if_t<is_container<T>::value, std::nullptr_t>;

} // namespace kk2

#endif // KK2_TYPE_TRAITS_CONTAINER_TRAITS_HPP
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
    raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: type_traits/container_traits.hpp: line 4: #pragma once found in a non-first line
Back to top page