Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chaofan Chen
ogs
Commits
4209d7ec
Commit
4209d7ec
authored
5 months ago
by
Dmitri Naumov
Committed by
Dmitri Naumov
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[BL] sizesToOffsets() w/ last entry sum(sizes)
parent
ebd8a07a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
BaseLib/Algorithm.h
+16
-0
16 additions, 0 deletions
BaseLib/Algorithm.h
BaseLib/CMakeLists.txt
+1
-0
1 addition, 0 deletions
BaseLib/CMakeLists.txt
with
17 additions
and
0 deletions
BaseLib/Algorithm.h
+
16
−
0
View file @
4209d7ec
...
@@ -16,6 +16,10 @@
...
@@ -16,6 +16,10 @@
#include
<optional>
#include
<optional>
#include
<range/v3/algorithm/find_if.hpp>
#include
<range/v3/algorithm/find_if.hpp>
#include
<range/v3/range/concepts.hpp>
#include
<range/v3/range/concepts.hpp>
#include
<range/v3/range/conversion.hpp>
#include
<range/v3/view/concat.hpp>
#include
<range/v3/view/partial_sum.hpp>
#include
<range/v3/view/single.hpp>
#include
<string>
#include
<string>
#include
<typeindex>
#include
<typeindex>
#include
<typeinfo>
#include
<typeinfo>
...
@@ -272,6 +276,18 @@ void cleanupVectorElements(std::vector<T1*>& dependent_items, Args&&... args)
...
@@ -272,6 +276,18 @@ void cleanupVectorElements(std::vector<T1*>& dependent_items, Args&&... args)
cleanupVectorElements
(
std
::
forward
<
Args
>
(
args
)...);
cleanupVectorElements
(
std
::
forward
<
Args
>
(
args
)...);
}
}
/// Converts range of sizes to a vector of offsets. First offset is 0 and the
/// resulting vector size is the size of the input range plus one.
template
<
ranges
::
range
R
>
requires
std
::
is_integral_v
<
ranges
::
range_value_t
<
R
>>
std
::
vector
<
ranges
::
range_value_t
<
R
>>
sizesToOffsets
(
R
const
&
sizes
)
{
return
ranges
::
views
::
concat
(
ranges
::
views
::
single
(
ranges
::
range_value_t
<
R
>
{
0
}),
ranges
::
views
::
partial_sum
(
sizes
))
|
ranges
::
to
<
std
::
vector
<
ranges
::
range_value_t
<
R
>>>
();
}
/// Checks if any of the elements in the given list is true.
/// Checks if any of the elements in the given list is true.
template
<
typename
List
>
template
<
typename
List
>
constexpr
bool
any_of
(
List
const
&
values
)
constexpr
bool
any_of
(
List
const
&
values
)
...
...
This diff is collapsed.
Click to expand it.
BaseLib/CMakeLists.txt
+
1
−
0
View file @
4209d7ec
...
@@ -12,6 +12,7 @@ target_link_libraries(
...
@@ -12,6 +12,7 @@ target_link_libraries(
BaseLib
BaseLib
PUBLIC Boost::algorithm
PUBLIC Boost::algorithm
Boost::property_tree
Boost::property_tree
range-v3
spdlog
spdlog
tclap
tclap
$<$<BOOL:
${
MSVC
}
>:WinMM>
# needed for timeGetTime
$<$<BOOL:
${
MSVC
}
>:WinMM>
# needed for timeGetTime
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment