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

Add concept constraint to UniqueTimestampFactory #58

Open
uselessgoddess opened this issue Aug 17, 2021 · 0 comments
Open

Add concept constraint to UniqueTimestampFactory #58

uselessgoddess opened this issue Aug 17, 2021 · 0 comments

Comments

@uselessgoddess
Copy link
Member

add

static_assert(IFactory<UniqueTimestampFactory, Timestamp>, 
                    "/* your message */");

after this

class UniqueTimestampFactory
{
private: std::uint64_t _lastTicks = 0;
public: Timestamp Create()
{
auto utcTicks = common_era_clock::to_ticks(common_era_clock::now());
_lastTicks = utcTicks > _lastTicks ? utcTicks : _lastTicks + 1;
return Timestamp(_lastTicks);
}
};

@uselessgoddess uselessgoddess changed the title Add concept constraint for UniqueTimestampFactory Add concept constraint to UniqueTimestampFactory Sep 2, 2021
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

1 participant