Core/Utils: Replace function overloads with if constexpr in e1503b0
This commit is contained in:
@@ -14,13 +14,14 @@
|
||||
# CollectAndAddSourceFiles(
|
||||
# common
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
# NO_INCLUDE_DIRECTORIES # if present, subdirectories will not be added to target include directories
|
||||
# EXCLUDE
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform
|
||||
# HEADER_VISIBILITY PRIVATE) # default is PUBLIC, this controls whether other targets that have this target as dependency will be able to access its headers
|
||||
#
|
||||
function(CollectAndAddSourceFiles target_name current_dir)
|
||||
cmake_parse_arguments(PARSE_ARGV 2 arg "" "BASE_DIR;HEADER_VISIBILITY" "EXCLUDE")
|
||||
cmake_parse_arguments(PARSE_ARGV 2 arg "NO_INCLUDE_SUBDIRECTORIES" "BASE_DIR;HEADER_VISIBILITY" "EXCLUDE")
|
||||
if(NOT arg_BASE_DIR)
|
||||
set(arg_BASE_DIR "${current_dir}")
|
||||
endif()
|
||||
@@ -44,8 +45,13 @@ function(CollectAndAddSourceFiles target_name current_dir)
|
||||
${current_dir}/*.hh
|
||||
${current_dir}/*.hpp)
|
||||
|
||||
set(fileset_include_directory "${current_dir}")
|
||||
if(arg_NO_INCLUDE_SUBDIRECTORIES)
|
||||
set(fileset_include_directory "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
target_sources(${target_name} PRIVATE ${private_source_files})
|
||||
target_sources(${target_name} ${arg_HEADER_VISIBILITY} FILE_SET "headers_${fileset_name}" TYPE HEADERS BASE_DIRS ${current_dir} FILES ${public_header_files})
|
||||
target_sources(${target_name} ${arg_HEADER_VISIBILITY} FILE_SET "headers_${fileset_name}" TYPE HEADERS BASE_DIRS ${fileset_include_directory} FILES ${public_header_files})
|
||||
|
||||
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
|
||||
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
|
||||
|
||||
@@ -73,25 +73,22 @@ namespace Trinity
|
||||
template <typename T>
|
||||
constexpr bool dependant_false_v = dependant_false<T>::value;
|
||||
|
||||
template <std::size_t... I>
|
||||
constexpr std::index_sequence<I...> concat_index_sequences(std::index_sequence<I...>)
|
||||
{
|
||||
return { };
|
||||
}
|
||||
|
||||
template <std::size_t... I, std::size_t... J, typename... Rest>
|
||||
constexpr auto concat_index_sequences(std::index_sequence<I...>, std::index_sequence<J...>, Rest...)
|
||||
{
|
||||
return Trinity::concat_index_sequences(std::index_sequence<I..., J...>(), Rest()...);
|
||||
if constexpr (sizeof...(Rest) > 0)
|
||||
return Trinity::concat_index_sequences(std::index_sequence<I..., J...>(), Rest()...);
|
||||
else
|
||||
return std::index_sequence<I..., J...>();
|
||||
}
|
||||
|
||||
namespace Impl
|
||||
{
|
||||
template <std::size_t I, typename Predicate>
|
||||
constexpr auto apply_index_sequence_filter(std::index_sequence<I> seq, Predicate predicate)
|
||||
constexpr auto apply_index_sequence_filter(std::index_sequence<I>, Predicate predicate)
|
||||
{
|
||||
if constexpr (predicate(seq))
|
||||
return seq;
|
||||
if constexpr (predicate(std::index_sequence<I>()))
|
||||
return std::index_sequence<I>();
|
||||
else
|
||||
return std::index_sequence<>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user