Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Harald Minde Hansen
Gaudi
Commits
7297a0d4
Commit
7297a0d4
authored
7 years ago
by
Charles Leggett
Browse files
Options
Downloads
Plain Diff
use detected_or idiom to simplify Range.h
See merge request
!572
parents
28d774ed
4e178f97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GaudiKernel/GaudiKernel/Range.h
+5
-25
5 additions, 25 deletions
GaudiKernel/GaudiKernel/Range.h
with
5 additions
and
25 deletions
GaudiKernel/GaudiKernel/Range.h
+
5
−
25
View file @
7297a0d4
...
...
@@ -12,6 +12,7 @@
// GaudiKernel
// ============================================================================
#include
"GaudiKernel/Kernel.h"
#include
"GaudiKernel/detected.h"
// ============================================================================
/** @file
*
...
...
@@ -42,34 +43,13 @@ namespace Gaudi
*/
GAUDI_API
void
rangeException
(
const
long
index
,
const
size_t
size
);
// ========================================================================
template
<
typename
T
>
struct
_has_typename_container_
{
private:
template
<
typename
T1
>
static
typename
T1
::
Container
test
(
int
);
template
<
typename
>
static
void
test
(
...
);
public:
enum
{
value
=
!
std
::
is_void
<
decltype
(
test
<
T
>
(
0
)
)
>::
value
};
};
template
<
class
CONTAINER
,
bool
>
struct
_container
;
template
<
class
CONTAINER
>
struct
_container
<
CONTAINER
,
true
>
{
typedef
typename
CONTAINER
::
Container
Container
;
};
template
<
class
CONTAINER
>
struct
_container
<
CONTAINER
,
false
>
{
typedef
CONTAINER
Container
;
};
// ==========================================================================
/// helper structure to get container type
template
<
class
CONTAINER
>
struct
container
{
typedef
typename
details
::
_container
<
CONTAINER
,
details
::
_has_typename_container_
<
CONTAINER
>::
value
>::
Container
Container
;
typedef
typename
CONTAINER
::
const_iterator
Iterator
;
template
<
typename
T
>
using
_has_container_t
=
typename
T
::
Container
;
using
Container
=
Gaudi
::
cpp17
::
detected_or_t
<
CONTAINER
,
_has_container_t
,
CONTAINER
>
;
using
Iterator
=
typename
CONTAINER
::
const_iterator
;
};
// =========================================================================
}
// the end of namespace Gaudi::details
...
...
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