Skip to content

Commit

Permalink
More cleanup, GlobRef now with correct reference semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchsto committed Mar 17, 2017
1 parent 5b3dca4 commit c52cfcf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
9 changes: 4 additions & 5 deletions dash/include/dash/Cartesian.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ class SizeSpec : public CartesianSpace<NumDimensions, SizeType>
/**
* Defines a cartesian, totally-ordered index space by mapping linear
* indices to cartesian coordinates depending on memory order.
*
* \note Not derived from CartesianSpace to provide resizing in O(d)
* instead of O(2d).
*/
template<
dim_t NumDimensions,
Expand All @@ -248,14 +251,10 @@ class CartesianIndexSpace
typedef SizeType size_type;
typedef std::array<SizeType, NumDimensions> extents_type;

/*
* Note: Not derived from CartesianSpace to provide resizing in O(d)
* instead of O(2d).
*/
protected:
/// Number of elements in the cartesian space spanned by this instance.
SizeType _size = 0;
/// Number of dimensions of the cartesian space, initialized with 0's.
/// Number of dimensions in the cartesian space.
SizeType _rank = NumDimensions;
/// Extents of the cartesian space by dimension.
extents_type _extents = { };
Expand Down
20 changes: 9 additions & 11 deletions dash/include/dash/GlobRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,16 @@ class GlobRef

public:
/**
* TODO: Reference semantics forbid declaration without definition.
*
* Default constructor, creates an GlobRef object referencing an element in
* global memory.
* Reference semantics forbid declaration without definition.
*/
GlobRef()
: _gptr(DART_GPTR_NULL)
{ }
GlobRef() = delete;

/**
* Constructor, creates an GlobRef object referencing an element in global
* memory.
*/
template<class PatternT, class ElementT>
explicit GlobRef(
explicit constexpr GlobRef(
/// Pointer to referenced object in global memory
GlobPtr<ElementT, PatternT> & gptr)
: GlobRef(gptr.dart_gptr())
Expand All @@ -86,7 +81,7 @@ class GlobRef
* memory.
*/
template<class PatternT, class ElementT>
explicit GlobRef(
explicit constexpr GlobRef(
/// Pointer to referenced object in global memory
const GlobPtr<ElementT, PatternT> & gptr)
: GlobRef(gptr.dart_gptr())
Expand All @@ -96,7 +91,7 @@ class GlobRef
* Constructor, creates an GlobRef object referencing an element in global
* memory.
*/
explicit GlobRef(dart_gptr_t dart_gptr)
explicit constexpr GlobRef(dart_gptr_t dart_gptr)
: _gptr(dart_gptr)
{ }

Expand All @@ -113,6 +108,9 @@ class GlobRef
*/
GlobRef(self_t && other) = default;

/**
* Value-assignment operator.
*/
GlobRef<T> & operator=(const T val) {
set(val);
return *this;
Expand Down Expand Up @@ -307,7 +305,7 @@ class GlobRef
return GlobPtr<T, PatternT>(_gptr);
}

dart_gptr_t dart_gptr() const {
constexpr dart_gptr_t dart_gptr() const noexcept {
return _gptr;
}

Expand Down

0 comments on commit c52cfcf

Please sign in to comment.