Skip to content

Commit

Permalink
[ABI/API BREAK] Massive internal refactoring
Browse files Browse the repository at this point in the history
* Moved allocator around + concepts
* Cleanup range concepts
* Vastly simplified hybrid size sequence
* Simplified kwk::shape
* Refurbished memory blocks handling
* Refurbished settings
* Move files around in details/
* Basic for_each
* Basic slicers interface for shape
  • Loading branch information
jfalcou authored Nov 14, 2022
1 parent cab867a commit 2ffa7b7
Show file tree
Hide file tree
Showing 169 changed files with 7,090 additions and 5,878 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ option( KIWAKU_BUILD_DOCS "Build docs for raberu" OFF )
if( KIWAKU_BUILD_TEST )
enable_testing()
include(CTest)
add_custom_target(kwk-unit)
add_custom_target(unit)
add_subdirectory(test)
endif()

Expand Down
4 changes: 1 addition & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ build_script:
- mkdir build
- cd build
- cmake -G "Visual Studio 17 2022" -A x64 .. -DKIWAKU_BUILD_TEST=ON
- cmake --build . --target kwk-unit --verbose --config Release
- cmake --build . --target kwk-unit --verbose --config Debug
- cmake --build . --target unit --verbose --config Release

test_script:
- ctest -C Release -VV
- ctest -C Debug -VV
4 changes: 2 additions & 2 deletions cmake/make_unit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function(source_to_target root ext filename testname)
string(REPLACE ".cpp" ".${ext}" base ${filename})
string(REPLACE "/" "." base ${base})
string(REPLACE "\\" "." base ${base})
SET(${testname} "kwk-${root}.${base}" PARENT_SCOPE)
SET(${testname} "${root}.${base}" PARENT_SCOPE)
endfunction()

function(setup_location test location)
Expand All @@ -50,7 +50,7 @@ function(make_unit root)
add_executable(${test} ${file})

add_target_parent(${test})
add_dependencies(kwk-unit ${test})
add_dependencies(unit ${test})

setup_location( ${test} "unit")
target_link_libraries(${test} PUBLIC kiwaku_test)
Expand Down
4 changes: 2 additions & 2 deletions include/kwk/algorithm.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//==================================================================================================
/**
/*
KIWAKU - Containers Well Made
Copyright : KIWAKU Project Contributors
SPDX-License-Identifier: BSL-1.0
**/
*/
//==================================================================================================
#pragma once

Expand Down
40 changes: 15 additions & 25 deletions include/kwk/algorithm/for_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,35 @@
//==================================================================================================
#pragma once

#include <kwk/concepts/container.hpp>
#include <kwk/detail/algorithm/for_each.hpp>
#include <kwk/detail/abi.hpp>
#include <cstddef>
#include <utility>

namespace kwk
{
namespace detail
//================================================================================================
// Order N for_each algorithm
//================================================================================================
template<typename Func, concepts::container Container>
constexpr auto for_each(Func&& f, Container&& c)
{
//================================================================================================
// n-Dimensional for_each algorithm
//================================================================================================
template<typename Func, typename Dim, typename Container>
constexpr void for_each(Func f, Container&& c, Dim d)
{
for(std::ptrdiff_t i=get<0>(d);i<get<1>(d);++i) f(KWK_FWD(c), i);
}

template<typename Func, typename Container, typename Dim, typename... Dims>
constexpr void for_each(Func f, Container&& c, Dim d0, Dims... ds)
return [&]<std::size_t... N>(std::index_sequence<N...> const&)
{
detail::for_each( [f,d0](auto&& x, auto... is)
{
for(std::ptrdiff_t i=get<0>(d0);i<get<1>(d0);++i)
f(KWK_FWD(x), i,is...);
}
, KWK_FWD(c)
, ds...
);
}
return detail::for_each(KWK_FWD(f), KWK_FWD(c), c.shape() );
}( std::make_index_sequence<std::remove_cvref_t<Container>::static_order>{} );
}

//================================================================================================
// Order N for_each algorithm
// Order N for_each_index algorithm
//================================================================================================
template<typename Func, typename Container>
constexpr void for_each(Func f, Container&& c)
template<typename Func, concepts::container Container>
constexpr auto for_each_index(Func&& f, Container&& c)
{
return [&]<std::size_t... N>(std::index_sequence<N...> const&)
{
return detail::for_each(f, KWK_FWD(c), kumi::tuple{first<N>(c),last<N>(c)}... );
return detail::for_each_index(KWK_FWD(f), KWK_FWD(c), c.shape() );
}( std::make_index_sequence<std::remove_cvref_t<Container>::static_order>{} );
}
}
128 changes: 0 additions & 128 deletions include/kwk/allocator/any_allocator.hpp

This file was deleted.

50 changes: 0 additions & 50 deletions include/kwk/allocator/heap_allocator.hpp

This file was deleted.

48 changes: 0 additions & 48 deletions include/kwk/concept/allocator.hpp

This file was deleted.

Loading

0 comments on commit 2ffa7b7

Please sign in to comment.