Skip to content

Name clash with std::vector #13

Closed
Closed

Description

@lionel-

I find it a bit confusing to read code with a templated class called vector that is not std::vector. How about cpp11::r_vector<>?

Activity

  1. jimhester commented on Jun 17, 2020

    @jimhester
    Member

    Sorry, my first reply was too harsh.

    I thought about this when I was writing it, but decided that namespaces gave it enough disambiguation. I deliberately always use the fully qualified name when using std::vectors in the internal code for this reason.

    We could probably also always use the fully qualified name internally when dealing with cpp11::vectors, just to make it completely clear which vector we are talking about at all times.

    Also I feel like the fact that the class template is really only internal makes this less severe, users will only see the non templated typedefs in their code and error messages.

  2. lionel- commented on Jun 18, 2020

    @lionel-
    MemberAuthor

    If it's only internal it's not that big a deal I guess. But I still think important class names should be unique even with the namespaces, otherwise reading code requires context switching.

  3. jimhester commented on Jun 29, 2020

    @jimhester
    Member

    The internal name does come up in error messages, even though the typedef is also shown e.g.

    no known conversion from 'cpp11::writable::list' (aka 'vector<SEXPREC *>') 
    

    So I think it might be worth renaming to r_vector to make that case more clear.

  4. added
    feature
    on Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions