Skip to content

Commit

Permalink
Update params.h
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Sep 23, 2024
1 parent 48cd2a4 commit eb46784
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/xtd.core/include/xtd/collections/generic/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ namespace xtd {
/// @}

/// @cond
params(const params&) noexcept = default;
params(params&&) noexcept = default;
params(const base_type& il) noexcept : items_(il) {}
params(base_type&& il) noexcept : items_(il) {}
params(base_type items) noexcept : items_(items) {}
params& operator =(base_type items) noexcept {items_ = items; return *this;}
/// @endcond

/// @name Public Properties
Expand All @@ -81,21 +79,21 @@ namespace xtd {
/// @return A pointer to the first element in the params.
/// @remarks If the params is empty, the values of begin() and end() are unspecified, but will be identical.
constexpr iterator begin() const noexcept {return items_.begin();}

/// @brief Returns pointer to the underlying array serving as element storage.
/// @return Pointer to the underlying element storage. For non-empty containers, the returned pointer compares equal to the address of the first element.
/// @remarks The pointer is such that range [xtd::collections::generic::list::data(), xtd::collections::generic::list::data() + xtd::collections::generic::list::size()) is always a valid range, even if the container is empty (xtd::collections::generic::list::data() is not dereferenceable in that case).
virtual const_pointer data() const noexcept {return reinterpret_cast<const_pointer>(begin());}

const_pointer data() const noexcept {return reinterpret_cast<const_pointer>(begin());}
/// @brief Returns a pointer to one past the last element in the params, i.e. begin() + size().
/// @return A pointer to one past the last element in the params.
/// @remarks If the params is empty, the values of begin() and end() are unspecified, but will be identical.
constexpr iterator end() const noexcept {return items_.end();}

/// @brief Returns the underlying base type items.
/// @return The underlying base type items.
virtual const base_type& items() const noexcept {return items_;}

const base_type& items() const noexcept {return items_;}
/// @brief Returns the number of elements in the params, i.e. `std::distance(begin(), end())`.
/// @return The number of elements in the params.
constexpr size_type size() const noexcept {return items_.size();}
Expand All @@ -113,14 +111,19 @@ namespace xtd {
/// @brief Returns a reference to the underlying base type.
/// @return Reference to the underlying base type.
operator const base_type&() const noexcept {return items_;}
/// @brief Returns a reference to the underlying base type.
/// @return Reference to the underlying base type.
operator base_type&() noexcept {return items_;}
/// @}

private:
base_type items_;
};

/// @cond
// C++17 deduction
// {
template<typename type_t>
params(std::initializer_list<type_t>) -> params<type_t>;
// }
/// @endcond
}
}
}
Expand Down

0 comments on commit eb46784

Please sign in to comment.