LCOV - code coverage report
Current view: top level - src/Def - TypeTraits.hpp (source / functions) Hit Total Coverage
Test: 3a807a259ebe0769dd942f7f612dca5273937539 Lines: 0 1 0.0 %
Date: 2024-03-24 17:16:54 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <Settings/NamespaceSettings.hpp>
       4             : 
       5             : #include <AH/STL/type_traits>
       6             : #include <AH/STL/utility>
       7             : 
       8             : BEGIN_CS_NAMESPACE
       9             : 
      10             : template <class...>
      11             : using void_t = void;
      12             : 
      13             : template <class, class = void>
      14             : struct has_method_begin : std::false_type {};
      15             : 
      16             : template <class T>
      17             : struct has_method_begin<T, void_t<decltype(std::declval<T>().begin())>>
      18             :     : std::true_type {};
      19             : 
      20             : /// Calls the `begin()` method of `t` if that method exists.
      21             : template <class T>
      22             : typename std::enable_if<has_method_begin<T>::value>::type
      23             : begin_if_possible(T &t) {
      24             :     t.begin();
      25             : }
      26             : 
      27             : template <class T>
      28             : typename std::enable_if<!has_method_begin<T>::value>::type
      29           0 : begin_if_possible(T &) {}
      30             : 
      31             : END_CS_NAMESPACE

Generated by: LCOV version 1.15