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

Compile error in C++17 #20

Closed
njh0602 opened this issue Nov 18, 2018 · 6 comments
Closed

Compile error in C++17 #20

njh0602 opened this issue Nov 18, 2018 · 6 comments

Comments

@njh0602
Copy link

njh0602 commented Nov 18, 2018

if use command line option /std:c++latest (c++17) in Visual Studio 2017,
compile error occurred about std::unary_function.

so i just remove the code public std::unary_function < ... > and it works.
like this

namespace std {
    template<>
    class hash< sole::uuid >/* public unary_function< sole::uuid, size_t > */ {
    public:
        // hash functor: hash uuid to size_t value by pseudorandomizing transform
        size_t operator()( const sole::uuid &uuid ) const {
            if( sizeof(size_t) > 4 ) {
                return size_t( uuid.ab ^ uuid.cd );
            } else {
                uint64_t hash64 = uuid.ab ^ uuid.cd;
                return size_t( uint32_t( hash64 >> 32 ) ^ uint32_t( hash64 ) );
            }
        }
    };
}

is it right?

@Ybalrid
Copy link
Contributor

Ybalrid commented Nov 18, 2018

This is funny, I just ran into the same exact issue minutes ago too. I've proposed the PR #21. I don't know if the original author of this library is still maintaining what's happening here. It seems this "archived" account is inactive, but they have a new account called @r-lyeh, but doesn't have a repository for this library.

@njh0602
Copy link
Author

njh0602 commented Nov 18, 2018

Nice timing! :) One more interesting thing is that using XCode's C ++ 17 compiler does not cause an error. So I could not find this error so far.

@Ybalrid
Copy link
Contributor

Ybalrid commented Nov 18, 2018 via email

@Ybalrid
Copy link
Contributor

Ybalrid commented Nov 18, 2018

Oh, the PR got accepted, you can probably close this issue

@njh0602 njh0602 closed this as completed Nov 19, 2018
@r-lyeh
Copy link
Collaborator

r-lyeh commented Nov 19, 2018

FYI, I am monitoring this repo with the new account from now :)

@Ybalrid
Copy link
Contributor

Ybalrid commented Nov 19, 2018

@r-lyeh Cool! Because this little library is genuinely useful. I needed to be sure to have unique identifiers for networked clients, and with this it's like, 4 lines of code to get a fairly strong -randomly wise- UUID.

Thanks for your work! 👌

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

No branches or pull requests

3 participants