Skip to content

Commit

Permalink
Revert "Allow chaining -> with pointer-like value types."
Browse files Browse the repository at this point in the history
This reverts commit 2321c7d.
  • Loading branch information
Louis-Charles Caron committed Nov 7, 2023
1 parent e47a723 commit ed9f254
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions include/safe/safe.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ template <typename ValueType, typename MutexType = std::mutex> class Safe
typename std::conditional<Mode == AccessMode::ReadOnly, const RemoveRefValueType, RemoveRefValueType>::type;

public:
/// Pointer-to-const ValueType
using ConstPointerType = const ConstIfReadOnlyValueType *;
/// Pointer-to-const ValueType if Mode is ReadOnly, pointer to ValueType otherwise.
using PointerType = ConstIfReadOnlyValueType *;
/// Reference-to-const ValueType
using ConstReferenceType = const ConstIfReadOnlyValueType &;
/// Reference-to-const ValueType if Mode is ReadOnly, reference to ValueType otherwise.
Expand Down Expand Up @@ -161,25 +165,25 @@ template <typename ValueType, typename MutexType = std::mutex> class Safe

/**
* @brief Const accessor to the value.
* @return ConstReferenceType Const pointer to the protected value.
* @return ConstPointerType Const pointer to the protected value.
*/
ConstReferenceType operator->() const noexcept
ConstPointerType operator->() const noexcept
{
return m_value;
return &m_value;
}

/**
* @brief Accessor to the value.
* @return ReferenceType Reference to the protected value.
* @return ValuePointerType Pointer to the protected value.
*/
ReferenceType operator->() noexcept
PointerType operator->() noexcept
{
return m_value;
return &m_value;
}

/**
* @brief Const accessor to the value.
* @return ConstReferenceType Const reference to the protected value.
* @return ConstValueReferenceType Const reference to the protected value.
*/
ConstReferenceType operator*() const noexcept
{
Expand All @@ -188,7 +192,7 @@ template <typename ValueType, typename MutexType = std::mutex> class Safe

/**
* @brief Accessor to the value.
* @return ReferenceType Reference to the protected.
* @return ValueReferenceType Reference to the protected.
*/
ReferenceType operator*() noexcept
{
Expand Down

0 comments on commit ed9f254

Please sign in to comment.