Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add x, y, and z shorthands to id and range classes #679

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions adoc/chapters/programming_interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11977,6 +11977,30 @@ size_t operator[](int dimension) const
a@ Return the value of the specified dimension of the
[code]#range#.

a@
[source]
----
size_t x() const noexcept;
gmlueck marked this conversation as resolved.
Show resolved Hide resolved
----
a@ Return the value of dimension [code]#Dimensions - 1# of the [code]#range#
object.

a@
[source]
----
size_t y() const noexcept;
----
a@ Return the value of dimension [code]#Dimensions - 2# of the [code]#range#
object, or 1 if [code]#Dimensions < 2#.

a@
[source]
----
size_t z() const noexcept;
----
a@ Return the value of dimension [code]#Dimensions - 3# of the [code]#range#
object, or 1 if [code]#Dimensions < 3#.

a@
[source]
----
Expand Down Expand Up @@ -12322,6 +12346,30 @@ size_t operator[](int dimension) const
a@ Return the value of the requested dimension of the [code]#id#
object.

a@
[source]
----
size_t x() const noexcept;
----
a@ Return the value of dimension [code]#Dimensions - 1# of the [code]#id#
object.

a@
[source]
----
size_t y() const noexcept;
----
a@ Return the value of dimension [code]#Dimensions - 2# of the [code]#id#
object, or 1 if [code]#Dimensions < 2#.

a@
[source]
----
size_t z() const noexcept;
----
a@ Return the value of dimension [code]#Dimensions - 3# of the [code]#id#
object, or 1 if [code]#Dimensions < 3#.

a@
[source]
----
Expand Down
4 changes: 4 additions & 0 deletions adoc/headers/id.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ template <int Dimensions = 1> class id {
size_t& operator[](int dimension);
size_t operator[](int dimension) const;

size_t x() const noexcept;
size_t y() const noexcept;
size_t z() const noexcept;

// only available if Dimensions == 1
operator size_t() const;

Expand Down
4 changes: 4 additions & 0 deletions adoc/headers/range.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ template <int Dimensions = 1> class range {
size_t& operator[](int dimension);
size_t operator[](int dimension) const;

size_t x() const noexcept;
size_t y() const noexcept;
size_t z() const noexcept;

size_t size() const;

// OP is: +, -, *, /, %, <<, >>, &, |, ^, &&, ||, <, >, <=, >=
Expand Down
Loading