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

[FEATURE] shape construction from std span and initializer_list #101

Open
psiha opened this issue Mar 16, 2023 · 6 comments
Open

[FEATURE] shape construction from std span and initializer_list #101

psiha opened this issue Mar 16, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@psiha
Copy link
Contributor

psiha commented Mar 16, 2023

via constructors or make/factory function (to avoid std::vector style () vs {} construction ambiguities)

@psiha psiha added the enhancement New feature or request label Mar 16, 2023
@jfalcou
Copy link
Owner

jfalcou commented Mar 16, 2023

this can be bolted onto of_size

@psiha
Copy link
Contributor Author

psiha commented Mar 16, 2023

(this is useful for unit tests)

@jfalcou
Copy link
Owner

jfalcou commented Mar 18, 2023

OK std::span can have a static size so we now the # of dimensions of the result.

BUT the size of an initializer_list is not so we need to force it ?

@psiha
Copy link
Contributor Author

psiha commented Mar 18, 2023

OK std::span can have a static size so we now the # of dimensions of the result.

BUT the size of an initializer_list is not so we need to force it ?

huh neither span nor initializer_list have a static size? (except if you mean in a constexpr context)
so yes, you have to assert that the size matches

@jfalcou
Copy link
Owner

jfalcou commented Mar 18, 2023

std::span<T,N> is a thing actually.

Assert that it matches with what ?

in the case of of_size({x,y,z]); ?
Or it means we need of_size(_3D, {x,y,z])`

@psiha
Copy link
Contributor Author

psiha commented Mar 18, 2023

std::span<T,N> is a thing actually.

oh right :D

Assert that it matches with what ?

that the runtime size matches the static size

in the case of of_size({x,y,z]); ? Or it means we need of_size(_3D, {x,y,z])`
yes you'd need the type

  • a constructor or
  • or member static factory
  • free func with a template parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants