diff --git a/CMakeLists.txt b/CMakeLists.txt index 56383ef..a2b830f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,24 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + cmake_minimum_required(VERSION 3.2) project(continuable VERSION 2.0.0 LANGUAGES C CXX) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4af7ea3..fc88bc1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1,5 +1,27 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + add_library(continuable-features-flags INTERFACE) add_library(continuable-features-warnings INTERFACE) add_library(continuable-features-noexcept INTERFACE) include(cmake/configure_compiler.cmake) +include(cmake/configure_macros.cmake) diff --git a/cmake/compiler/clang.cmake b/cmake/compiler/clang.cmake index 63e7a14..efa2da2 100644 --- a/cmake/compiler/clang.cmake +++ b/cmake/compiler/clang.cmake @@ -1,3 +1,24 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Enable full warnings target_compile_options(continuable-features-warnings INTERFACE diff --git a/cmake/compiler/gcc.cmake b/cmake/compiler/gcc.cmake index 4eaefc1..64c0473 100644 --- a/cmake/compiler/gcc.cmake +++ b/cmake/compiler/gcc.cmake @@ -1,3 +1,24 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Enable full warnings target_compile_options(continuable-features-warnings INTERFACE diff --git a/cmake/compiler/msvc.cmake b/cmake/compiler/msvc.cmake index 9ede127..f109e99 100644 --- a/cmake/compiler/msvc.cmake +++ b/cmake/compiler/msvc.cmake @@ -1,3 +1,24 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + if(CMAKE_SIZEOF_VOID_P MATCHES 8) set(PLATFORM 64) else() diff --git a/cmake/configure_compiler.cmake b/cmake/configure_compiler.cmake index 8a1b89b..33d3957 100644 --- a/cmake/configure_compiler.cmake +++ b/cmake/configure_compiler.cmake @@ -1,3 +1,24 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Select the compiler specific cmake file set(MSVC_ID "MSVC") if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") diff --git a/cmake/configure_macros.cmake b/cmake/configure_macros.cmake new file mode 100644 index 0000000..91b6bac --- /dev/null +++ b/cmake/configure_macros.cmake @@ -0,0 +1,22 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +include(${CMAKE_SOURCE_DIR}/cmake/macros/group_sources.cmake) diff --git a/cmake/macros/group_sources.cmake b/cmake/macros/group_sources.cmake new file mode 100644 index 0000000..b1b5d70 --- /dev/null +++ b/cmake/macros/group_sources.cmake @@ -0,0 +1,58 @@ + +# Copyright(c) 2015 - 2018 Denis Blank +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions : +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set(WITH_SOURCE_TREE "hierarchical") +macro(group_sources dir) + # Skip this if WITH_SOURCE_TREE is not set (empty string). + if (NOT ${WITH_SOURCE_TREE} STREQUAL "") + # Include all header and c files + file(GLOB_RECURSE elements RELATIVE ${dir} *.h *.hpp *.inl *.inc *.c *.cpp *.cc) + + foreach(element ${elements}) + # Extract filename and directory + get_filename_component(element_name ${element} NAME) + get_filename_component(element_dir ${element} DIRECTORY) + + if (NOT ${element_dir} STREQUAL "") + # If the file is in a subdirectory use it as source group. + if (${WITH_SOURCE_TREE} STREQUAL "flat") + # Build flat structure by using only the first subdirectory. + string(FIND ${element_dir} "/" delemiter_pos) + if (NOT ${delemiter_pos} EQUAL -1) + string(SUBSTRING ${element_dir} 0 ${delemiter_pos} group_name) + source_group("${group_name}" FILES ${dir}/${element}) + else() + # Build hierarchical structure. + # File is in root directory. + source_group("${element_dir}" FILES ${dir}/${element}) + endif() + else() + # Use the full hierarchical structure to build source_groups. + string(REPLACE "/" "\\" group_name ${element_dir}) + source_group("${group_name}" FILES ${dir}/${element}) + endif() + else() + # If the file is in the root directory, place it in the root source_group. + source_group("\\" FILES ${dir}/${element}) + endif() + endforeach() + endif() +endmacro() diff --git a/include/continuable/detail/composition.hpp b/include/continuable/detail/composition.hpp index 1fac3b2..598abb7 100644 --- a/include/continuable/detail/composition.hpp +++ b/include/continuable/detail/composition.hpp @@ -59,7 +59,7 @@ struct is_strategy : std::true_type {}; template <> struct is_strategy : std::true_type {}; - namespace detail { +namespace detail { template constexpr void assign(traits::size_constant /*pos*/, T& /*storage*/) { // ... diff --git a/test/playground/CMakeLists.txt b/test/playground/CMakeLists.txt index 39213ab..35c3f05 100644 --- a/test/playground/CMakeLists.txt +++ b/test/playground/CMakeLists.txt @@ -1,31 +1,8 @@ -set(LIB_SOURCES - ${CMAKE_SOURCE_DIR}/include/continuable/continuable.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-types.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-base.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-compositions.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-trait.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-promise-base.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-promisify.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-transforms.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-traverse.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-traverse-async.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/continuable-testing.hpp) -set(LIB_SOURCES_DETAIL - ${CMAKE_SOURCE_DIR}/include/continuable/detail/awaiting.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/base.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/composition.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/expected.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/hints.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/promisify.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/container-category.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/traverse.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/traverse-async.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/features.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/traits.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/transforms.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/types.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/testing.hpp - ${CMAKE_SOURCE_DIR}/include/continuable/detail/util.hpp) +set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/continuable) + +file(GLOB LIB_SOURCES ${INCLUDE_DIR}/*.hpp) +file(GLOB_RECURSE LIB_SOURCES_DETAIL ${INCLUDE_DIR}/detail/*.hpp) + set(TEST ${CMAKE_CURRENT_LIST_DIR}/test-playground.cpp ${CMAKE_CURRENT_LIST_DIR}/comp.cpp) @@ -35,8 +12,8 @@ add_executable(test-playground ${LIB_SOURCES_DETAIL} ${TEST}) -source_group(src FILES ${LIB_SOURCES}) -source_group(src\\detail FILES ${LIB_SOURCES_DETAIL}) +source_group(continuable FILES ${LIB_SOURCES}) +source_group(continuable\\detail FILES ${LIB_SOURCES_DETAIL}) source_group(test FILES ${TEST}) target_link_libraries(test-playground diff --git a/test/playground/comp.cpp b/test/playground/comp.cpp index c7cca28..4b3f6af 100644 --- a/test/playground/comp.cpp +++ b/test/playground/comp.cpp @@ -203,6 +203,7 @@ constexpr auto create_index_pack(Args&&... args) { template constexpr void relocate_index_pack(Relocator&& relocator, Index* index, Target* target) { + constexpr traversal::container_category_of_t const tag; detail::result_relocator_mapper> mapper{