Skip to content

Commit

Permalink
Use full form for lambdas and canonical forms for IIFEs.
Browse files Browse the repository at this point in the history
This more easily distinguishes the declaration versus invocation of a lambda.
  • Loading branch information
LTLA committed Feb 5, 2025
1 parent 1003cd5 commit 16033bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion include/tatami_chunked/SlabCacheStats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct SlabCacheStats {
*/
SlabCacheStats(size_t target_length, size_t non_target_length, size_t target_num_slabs, size_t cache_size_in_bytes, size_t element_size, bool require_minimum_cache) :
slab_size_in_elements(target_length * non_target_length),
max_slabs_in_cache([&]() {
max_slabs_in_cache([&]{
if (element_size == 0) {
return target_num_slabs;
} else {
Expand Down
32 changes: 16 additions & 16 deletions include/tatami_chunked/custom_internals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class ChunkCoordinator {

extract_secondary_block(
row, chunk_id, secondary_block_start, secondary_block_length,
[&](const Chunk_& chunk, Index_ from, Index_ len, Index_ secondary_start_pos) {
[&](const Chunk_& chunk, Index_ from, Index_ len, Index_ secondary_start_pos) -> void {
auto& tmp_values = tmp_work.get_values();
auto& tmp_indices = tmp_work.get_indices();
auto& tmp_number = tmp_work.get_number();
Expand Down Expand Up @@ -318,7 +318,7 @@ class ChunkCoordinator {

extract_secondary_block(
row, chunk_id, secondary_block_start, secondary_block_length,
[&](const Chunk_& chunk, Index_ from, Index_ len) {
[&](const Chunk_& chunk, Index_ from, Index_ len) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, chunk_offset, 1, from, len, chunk_workspace, tmp_buffer_ptr, len);
} else {
Expand Down Expand Up @@ -358,7 +358,7 @@ class ChunkCoordinator {

extract_secondary_index(
row, chunk_id, secondary_indices, chunk_indices_buffer,
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices, Index_ secondary_start_pos) {
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices, Index_ secondary_start_pos) -> void {
auto& tmp_values = tmp_work.get_values();
auto& tmp_indices = tmp_work.get_indices();
auto& tmp_number = tmp_work.get_number();
Expand Down Expand Up @@ -387,7 +387,7 @@ class ChunkCoordinator {

extract_secondary_index(
row, chunk_id, secondary_indices, chunk_indices_buffer,
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices) {
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices) -> void {
size_t nidx = chunk_indices.size();
if constexpr(Chunk_::use_subset) {
chunk.extract(row, chunk_offset, 1, chunk_indices, chunk_workspace, tmp_buffer_ptr, nidx);
Expand Down Expand Up @@ -422,7 +422,7 @@ class ChunkCoordinator {

extract_secondary_block(
row, chunk_id, secondary_block_start, secondary_block_length,
[&](const Chunk_& chunk, Index_ from, Index_ len, Index_ secondary_start_pos) {
[&](const Chunk_& chunk, Index_ from, Index_ len, Index_ secondary_start_pos) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, chunk_offset, chunk_length, from, len, chunk_workspace, slab.values, slab.indices, slab.number, secondary_start_pos);
} else {
Expand All @@ -437,7 +437,7 @@ class ChunkCoordinator {

extract_secondary_block(
row, chunk_id, secondary_block_start, secondary_block_length,
[&](const Chunk_& chunk, Index_ from, Index_ len) {
[&](const Chunk_& chunk, Index_ from, Index_ len) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, chunk_offset, chunk_length, from, len, chunk_workspace, slab_ptr, stride);
} else {
Expand Down Expand Up @@ -465,7 +465,7 @@ class ChunkCoordinator {

extract_secondary_index(
row, chunk_id, secondary_indices, chunk_indices_buffer,
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices, Index_ secondary_start_pos) {
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices, Index_ secondary_start_pos) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, chunk_offset, chunk_length, chunk_indices, chunk_workspace, slab.values, slab.indices, slab.number, secondary_start_pos);
} else {
Expand All @@ -480,7 +480,7 @@ class ChunkCoordinator {

extract_secondary_index(
row, chunk_id, secondary_indices, chunk_indices_buffer,
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices) {
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, chunk_offset, chunk_length, chunk_indices, chunk_workspace, slab_ptr, stride);
} else {
Expand Down Expand Up @@ -508,7 +508,7 @@ class ChunkCoordinator {

extract_secondary_block(
row, chunk_id, secondary_block_start, secondary_block_length,
[&](const Chunk_& chunk, Index_ from, Index_ len, Index_ secondary_start_pos) {
[&](const Chunk_& chunk, Index_ from, Index_ len, Index_ secondary_start_pos) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, primary_indices, from, len, chunk_workspace, slab.values, slab.indices, slab.number, secondary_start_pos);
} else {
Expand All @@ -523,7 +523,7 @@ class ChunkCoordinator {

extract_secondary_block(
row, chunk_id, secondary_block_start, secondary_block_length,
[&](const Chunk_& chunk, Index_ from, Index_ len) {
[&](const Chunk_& chunk, Index_ from, Index_ len) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, primary_indices, from, len, chunk_workspace, slab_ptr, stride);
} else {
Expand All @@ -550,7 +550,7 @@ class ChunkCoordinator {

extract_secondary_index(
row, chunk_id, secondary_indices, chunk_indices_buffer,
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices, Index_ secondary_start_pos) {
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices, Index_ secondary_start_pos) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, primary_indices, chunk_indices, chunk_workspace, slab.values, slab.indices, slab.number, secondary_start_pos);
} else {
Expand All @@ -565,7 +565,7 @@ class ChunkCoordinator {

extract_secondary_index(
row, chunk_id, secondary_indices, chunk_indices_buffer,
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices) {
[&](const Chunk_& chunk, const std::vector<Index_>& chunk_indices) -> void {
if constexpr(Chunk_::use_subset) {
chunk.extract(row, primary_indices, chunk_indices, chunk_workspace, slab_ptr, stride);
} else {
Expand Down Expand Up @@ -698,10 +698,10 @@ class ChunkCoordinator {
row,
cache,
factory,
[&](Index_ pid, Index_ pstart, Index_ plen, Slab& slab) {
[&](Index_ pid, Index_ pstart, Index_ plen, Slab& slab) -> void {
fetch_block(row, pid, pstart, plen, block_start, block_length, slab, chunk_workspace);
},
[&](Index_ pid, const std::vector<Index_>& pindices, Slab& slab) {
[&](Index_ pid, const std::vector<Index_>& pindices, Slab& slab) -> void {
fetch_index(row, pid, pindices, block_start, block_length, slab, chunk_workspace);
}
);
Expand All @@ -720,10 +720,10 @@ class ChunkCoordinator {
row,
cache,
factory,
[&](Index_ pid, Index_ pstart, Index_ plen, Slab& slab) {
[&](Index_ pid, Index_ pstart, Index_ plen, Slab& slab) -> void {
fetch_block(row, pid, pstart, plen, indices, chunk_indices_buffer, slab, chunk_workspace);
},
[&](Index_ pid, const std::vector<Index_>& pindices, Slab& slab) {
[&](Index_ pid, const std::vector<Index_>& pindices, Slab& slab) -> void {
fetch_index(row, pid, pindices, indices, chunk_indices_buffer, slab, chunk_workspace);
}
);
Expand Down

0 comments on commit 16033bd

Please sign in to comment.