Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
amdis
amdis-core
Merge requests
!100
Added extended AllTrueBitSetVector class
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Added extended AllTrueBitSetVector class
feature/alltruebitsetvector
into
master
Overview
4
Commits
3
Changes
4
All threads resolved!
Hide all comments
Merged
Praetorius, Simon
requested to merge
feature/alltruebitsetvector
into
master
5 years ago
Overview
4
Commits
3
Changes
3
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Compare
version 2
version 2
d4b9a66f
5 years ago
version 1
16eaf7a6
5 years ago
master (base)
and
latest version
latest version
aa317187
3 commits,
5 years ago
version 2
d4b9a66f
2 commits,
5 years ago
version 1
16eaf7a6
1 commit,
5 years ago
Show latest version
3 files
+
93
−
16
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/amdis/utility/AllTrueBitSetVector.hpp
+
54
−
16
Options
#pragma once
#include
<cstddef>
#include
<iterator>
namespace
AMDiS
{
/// \brief Vector-like container of bools returning always true
/// \brief Vector-like container of bools returning always true.
/**
* Model of an infinite range of bools of value `true` with vector-like element
* access by `operator[]`.
**/
class
AllTrueBitSetVector
{
public:
using
value_type
=
bool
;
struct
const_iterator
{
constexpr
const_iterator
(
bool
sentinel
=
false
)
noexcept
:
sentinel_
(
sentinel
)
{}
using
value_type
=
bool
;
using
reference
=
bool
;
using
difference_type
=
std
::
ptrdiff_t
;
using
iterator_category
=
std
::
forward_iterator_tag
;
constexpr
bool
operator
*
()
const
noexcept
{
return
true
;
}
constexpr
const_iterator
&
operator
++
()
noexcept
{
return
*
this
;
}
constexpr
const_iterator
operator
++
(
int
)
noexcept
{
return
*
this
;
}
/// Comparison of the iterator is always true if both are sentinel or both are const_iterator
friend
constexpr
bool
operator
==
(
const_iterator
a
,
const_iterator
b
)
noexcept
{
return
a
.
sentinel_
==
b
.
sentinel_
;
}
bool
sentinel_
=
false
;
/// Comparison of the iterator is always true
constexpr
bool
operator
==
(
const_iterator
)
const
noexcept
{
return
true
;
}
constexpr
bool
operator
!=
(
const_iterator
)
const
noexcept
{
return
false
;
}
};
/// Constexpr default constructor
constexpr
AllTrueBitSetVector
()
noexcept
=
default
;
public
:
// element access
/// Converting to true
constexpr
operator
bool
()
const
noexcept
{
return
true
;
}
/// Access any element of the container return
ing
always true.
/// Access
to
any element of the container return
s
always true.
template
<
class
Index
>
constexpr
const
AllTrueBitSetVector
&
operator
[](
Index
const
&
/*index*/
)
const
noexcept
constexpr
AllTrueBitSetVector
const
&
at
(
Index
const
&
/*index*/
)
const
noexcept
{
return
*
this
;
}
/// Access to any element of the container returns always true.
template
<
class
Index
>
constexpr
AllTrueBitSetVector
const
&
operator
[](
Index
const
&
/*index*/
)
const
noexcept
{
return
*
this
;
}
/// Access the front element of the infinite range
constexpr
AllTrueBitSetVector
const
&
front
()
const
noexcept
{
return
*
this
;
}
public
:
// iterators
/// Return iterator that always redirects to a bool true.
constexpr
const_iterator
begin
()
const
noexcept
{
return
const_iterator
{
false
};
}
constexpr
const_iterator
end
()
const
noexcept
{
return
const_iterator
{
true
};
}
constexpr
const_iterator
begin
()
const
noexcept
{
return
const_iterator
{};
}
/// Return iterator that always redirects to a bool true.
constexpr
const_iterator
cbegin
()
const
noexcept
{
return
const_iterator
{
false
};
}
constexpr
const_iterator
cend
()
const
noexcept
{
return
const_iterator
{
true
};
}
constexpr
const_iterator
cbegin
()
const
noexcept
{
return
const_iterator
{};
}
public
:
// capacity and modifier
/// Resize does nothing
template
<
class
Size
>
constexpr
void
resize
(
Size
const
&
/*size*/
)
const
noexcept
{
/* do nothing */
}
constexpr
void
resize
(
Size
const
&
/*size*/
)
const
noexcept
{
/* do nothing */
}
/// The container is always non-empty
constexpr
bool
empty
()
const
noexcept
{
return
false
;
}
};
}
// end namespace AMDiS
Loading