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
wenqing
ogs
Commits
df19e77f
Commit
df19e77f
authored
6 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[BL] Move IntegerSequence into Functional.
parent
7a1e84b6
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/Functional.h
+29
-1
29 additions, 1 deletion
BaseLib/Functional.h
BaseLib/TMPUtil.h
+0
-43
0 additions, 43 deletions
BaseLib/TMPUtil.h
with
29 additions
and
44 deletions
BaseLib/Functional.h
+
29
−
1
View file @
df19e77f
...
...
@@ -11,7 +11,6 @@
#include
<functional>
#include
"baselib_export.h"
#include
"BaseLib/TMPUtil.h"
namespace
BaseLib
{
...
...
@@ -139,6 +138,35 @@ struct FunctionTraits<ReturnType (Object::*)(Args...) const> {
}
// namespace detail
//! Has sequence of integers as template parameters
template
<
int
...>
struct
IntegerSequence
{
};
//! Generates an IntegerSequence.
//!
//! \see http://stackoverflow.com/a/7858971
template
<
int
N
,
int
...
S
>
struct
GenerateIntegerSequence
{
// effectively pushes N-1 from the left to the list int... S of integers.
using
type
=
typename
GenerateIntegerSequence
<
N
-
1
,
N
-
1
,
S
...
>::
type
;
};
template
<
int
...
S
>
struct
GenerateIntegerSequence
<
0
,
S
...
>
{
using
type
=
IntegerSequence
<
S
...
>
;
};
/* The template metaprogram proceeds in the following way:
*
* GenerateIntegerSequence<sizeof...(Args)>::type
*
* Assume sizeof...(Args) == 3. Let GIS := GenerateIntegerSequence
* GIS<3, []>
* -> GIS<2, [2]>
* -> GIS<1, [1, 2]>
* -> GIS<0, [0, 1, 2], which has member typedef IntegerSequence<0, 1, 2>
*/
/*! Convenience wrapper for std::bind().
*
* This function binds the member function pointer \c member of class \c Object
...
...
This diff is collapsed.
Click to expand it.
BaseLib/TMPUtil.h
deleted
100644 → 0
+
0
−
43
View file @
7a1e84b6
/**
* \copyright
* Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
namespace
BaseLib
{
//! Has sequence of integers as template parameters
template
<
int
...>
struct
IntegerSequence
{
};
//! Generates an IntegerSequence.
//!
//! \see http://stackoverflow.com/a/7858971
template
<
int
N
,
int
...
S
>
struct
GenerateIntegerSequence
{
// effectively pushes N-1 from the left to the list int... S of integers.
using
type
=
typename
GenerateIntegerSequence
<
N
-
1
,
N
-
1
,
S
...
>::
type
;
};
template
<
int
...
S
>
struct
GenerateIntegerSequence
<
0
,
S
...
>
{
using
type
=
IntegerSequence
<
S
...
>
;
};
/* The template metaprogram proceeds in the following way:
*
* GenerateIntegerSequence<sizeof...(Args)>::type
*
* Assume sizeof...(Args) == 3. Let GIS := GenerateIntegerSequence
* GIS<3, []>
* -> GIS<2, [2]>
* -> GIS<1, [1, 2]>
* -> GIS<0, [0, 1, 2], which has member typedef IntegerSequence<0, 1, 2>
*/
}
// namespace BaseLib
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