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

Implement typed_array #61

Closed
jjerphan opened this issue Apr 4, 2024 · 1 comment · Fixed by #65
Closed

Implement typed_array #61

jjerphan opened this issue Apr 4, 2024 · 1 comment · Fixed by #65
Assignees

Comments

@jjerphan
Copy link
Collaborator

jjerphan commented Apr 4, 2024

A layout class and the array_data structure are gathered into the typed_array template class, which provides an API very similar to that of std::vector:

template <class T, class L = get_default_layout_t<T>>
class typed_array
{
public:
    
    using layout_type = L;
    using reference = typename layout_type::reference;
    using const_reference = typename layout_type::const_reference;
    
    size_type size() const;
    reference operator[](size_type);
    const_reference operator[](size_type) const;
    
private:
    
    layout_type m_layout;
    array_data m_data;
};

Design from @JohanMabille.

@JohanMabille
Copy link
Collaborator

This API is non exhaustive, the typed_arrya should also have the iterators, front / back, etc ..

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

Successfully merging a pull request may close this issue.

3 participants