Loading...
Searching...
No Matches
PotCapabilities.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13
14#include "Potential.h"
15#include <concepts>
16#include <type_traits>
17
18namespace eonc {
19
23template <class P>
24concept ThreadSafeQueryable = requires(const P &p) {
25 { p.isThreadSafe() } -> std::convertible_to<bool>;
26};
27
28template <class P>
30[[nodiscard]] bool potIsThreadSafe(const P &p) noexcept {
31 return p.isThreadSafe();
32}
33
34template <class P>
35 requires requires(const P &p) {
36 { p.isSharedInstanceThreadSafe() } -> std::convertible_to<bool>;
37 }
38[[nodiscard]] bool potAllowsSharedInstance(const P &p) noexcept {
39 return p.isSharedInstanceThreadSafe();
40}
41
42} // namespace eonc
Duck-typed thread-safety query.
RAII resource manager for the ARTn C library with global synchronization.
bool potIsThreadSafe(const P &p) noexcept
bool potAllowsSharedInstance(const P &p) noexcept