DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
isContainer.hpp
Go to the documentation of this file.
1// Copyright (c) 2020-2025 Cody R. Drisko. All rights reserved.
2// Licensed under the MIT License. See the LICENSE file in the project root for more information.
3//
4// Name: isContainer.hpp
5// Author: crdrisko
6// Date: 09/15/2020-08:38:28
7// Description: A type trait for determining whether a type T meets the requirements of a container
8
9#ifndef DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TRAITS_CONTAINERTRAITS_ISCONTAINER_HPP
10#define DRYCHEM_COMMON_UTILITIES_INCLUDE_COMMON_UTILS_META_TRAITS_CONTAINERTRAITS_ISCONTAINER_HPP
11
12#include <type_traits>
13#include <utility>
14
15namespace CppUtils::Meta
16{
23 template<typename, typename = std::void_t<>>
24 struct is_container : std::false_type
25 {
26 };
27
37 template<typename T>
38 struct is_container<T, std::void_t<typename T::value_type,
39 typename T::reference,
40 typename T::const_reference,
41 typename T::iterator,
42 typename T::const_iterator,
43 typename T::difference_type,
44 typename T::size_type,
45 decltype(std::declval<T>().begin()),
46 decltype(std::declval<T>().end()),
47 decltype(std::declval<T>().cbegin()),
48 decltype(std::declval<T>().cend()),
49 decltype(std::declval<T>().max_size()),
50 decltype(std::declval<T>().empty())>> : std::true_type
51 {
52 };
53
55 template<typename T>
57} // namespace CppUtils::Meta
58
59#endif
Definition frontList.hpp:13
constexpr bool is_container_v
Convenience variable template for ease-of-use.
Definition isContainer.hpp:56
Definition isContainer.hpp:25