8000 you are pulling 'std::variant' into the global namespace (bad idea) · Issue #108 · p-ranav/tabulate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
you are pulling 'std::variant' into the global namespace (bad idea) #108
Open
@peterritter

Description

@peterritter

Hi

I have been struggling with some compiler errors involving 'variant'. I have my own 'variant' class in my library and it seemed to be clashing when I pulled in the tabulate header. I had a look and found this in tabulate.hpp:

#if __cplusplus >= 201703L
#include <string_view>
#include
using std::get_if;
using std::holds_alternative;
using std::string_view;
using std::variant;
using std::visit;

This is not a good practice to pull names from the standard library into the global namespace! Every library that uses tabulate will now have these names in the global namespace too.

I also found std::optional used this way.

I have manually gone and commented out all such using statements and added std:: prefix everywhere where they were used. It is not a lot of places - so it seems an easy fix!

Best Regards, P.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0