Skip to content

Commit

Permalink
Merge pull request #276 from dash-project/bug-266-umap
Browse files Browse the repository at this point in the history
Cleanup in dash::UnorderedMapGlobIter
  • Loading branch information
fuchsto authored Feb 13, 2017
2 parents f238aeb + 1eed924 commit 693e73c
Showing 1 changed file with 26 additions and 31 deletions.
57 changes: 26 additions & 31 deletions dash/include/dash/map/UnorderedMapGlobIter.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ class UnorderedMapGlobIter
return *this;
}

inline bool operator==(std::nullptr_t) const noexcept
constexpr bool operator==(std::nullptr_t) const noexcept
{
return _is_nullptr;
}

inline bool operator!=(std::nullptr_t) const noexcept
constexpr bool operator!=(std::nullptr_t) const noexcept
{
return !_is_nullptr;
}
Expand All @@ -209,7 +209,7 @@ class UnorderedMapGlobIter
*
* \return A global reference to the element at the iterator's position
*/
operator pointer() const
constexpr operator pointer() const
{
return pointer(dart_gptr());
}
Expand All @@ -220,15 +220,12 @@ class UnorderedMapGlobIter
* \return A DART global pointer to the element at the iterator's
* position
*/
dart_gptr_t dart_gptr() const
constexpr dart_gptr_t dart_gptr() const
{
DASH_LOG_TRACE_VAR("UnorderedMapGlobIter.dart_gptr()", _idx);
dart_gptr_t dart_gptr = _map->globmem().at(
_idx_unit_id,
_idx_local_idx)
.dart_gptr();
DASH_LOG_TRACE_VAR("UnorderedMapGlobIter.dart_gptr >", dart_gptr);
return dart_gptr;
return _map->globmem().at(
_idx_unit_id,
_idx_local_idx)
.dart_gptr();
}

/**
Expand Down Expand Up @@ -285,7 +282,7 @@ class UnorderedMapGlobIter
* Checks whether the element referenced by this global iterator is in
* the calling unit's local memory.
*/
inline bool is_local() const noexcept
constexpr bool is_local() const noexcept
{
return (_myid == _idx_unit_id);
}
Expand All @@ -302,7 +299,6 @@ class UnorderedMapGlobIter
return (_map->lbegin() + _idx_local_idx);
}

#if 0
/**
* Conversion to local bucket iterator.
*/
Expand All @@ -314,7 +310,6 @@ class UnorderedMapGlobIter
}
return (_map->lbegin() + _idx_local_idx);
}
#endif

/**
* Unit and local offset at the iterator's position.
Expand All @@ -330,23 +325,23 @@ class UnorderedMapGlobIter
/**
* Map iterator to global index domain.
*/
inline self_t global() const noexcept
constexpr self_t global() const noexcept
{
return *this;
}

/**
* Position of the iterator in global index space.
*/
inline index_type pos() const noexcept
constexpr index_type pos() const noexcept
{
return _idx;
}

/**
* Position of the iterator in global index range.
*/
inline index_type gpos() const noexcept
constexpr index_type gpos() const noexcept
{
return _idx;
}
Expand Down Expand Up @@ -390,14 +385,14 @@ class UnorderedMapGlobIter
}

template<typename K_, typename M_, typename H_, typename P_, typename A_>
inline bool operator==(
constexpr bool operator==(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const noexcept
{
return (this == std::addressof(other) || _idx == other._idx);
}

template<typename K_, typename M_, typename H_, typename P_, typename A_>
inline bool operator!=(
constexpr bool operator!=(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const noexcept
{
return !(*this == other);
Expand Down Expand Up @@ -429,42 +424,42 @@ class UnorderedMapGlobIter
return res;
}

inline index_type operator+(
const self_t & other) const
constexpr index_type operator+(
const self_t & other) const noexcept
{
return _idx + other._idx;
}

inline index_type operator-(
const self_t & other) const
constexpr index_type operator-(
const self_t & other) const noexcept
{
return _idx - other._idx;
}

template<typename K_, typename M_, typename H_, typename P_, typename A_>
inline bool operator<(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const
constexpr bool operator<(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const noexcept
{
return (_idx < other._idx);
}

template<typename K_, typename M_, typename H_, typename P_, typename A_>
inline bool operator<=(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const
constexpr bool operator<=(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const noexcept
{
return (_idx <= other._idx);
}

template<typename K_, typename M_, typename H_, typename P_, typename A_>
inline bool operator>(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const
constexpr bool operator>(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const noexcept
{
return (_idx > other._idx);
}

template<typename K_, typename M_, typename H_, typename P_, typename A_>
inline bool operator>=(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const
constexpr bool operator>=(
const UnorderedMapGlobIter<K_, M_, H_, P_, A_> & other) const noexcept
{
return (_idx >= other._idx);
}
Expand Down

0 comments on commit 693e73c

Please sign in to comment.