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

Make some things constexpr #57

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

goto-bus-stop
Copy link

@goto-bus-stop goto-bus-stop commented Feb 5, 2020

This constexpr-ifies just enough things to allow for a constexpr Guid(std::string_view) constructor. Now you can write readable GUIDs at compile time:

static constexpr auto SomeGuid = xg::Guid("AF465C71-9588-11cf-A020-00AA006157AC");

After that, there was barely any code left in the guid.cpp file. I moved the remaining short functions into the header file too. Only newGuid() requires that users add the guid.cpp file to their compilation, to avoid pulling things like the windows.h header or a libuuid dependency in the header file. This is kinda just a thing I like but not necessary by any stretch so if you don't prefer it I'm happy to revert that.

Some of the constexpr methods have manually written loops instead of non-constexpr std::fill and stuff. isValid() and zeroify() are both required by the Guid(std::string_view) constructor so I had to make do to make that constexpr :)

Also updated CI to work again. The MATRIX_EVAL stuff appears to be broken despite Travis recommending it in their docs? Weird. Removed the Homebrew update that was taking ages, Travis must've updated the CMake version on their OSX image at some point because it's now recent enough.

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 this pull request may close these issues.

1 participant