Files
lix/lix/libutil/concepts.hh
T
eldritch horrorsandjade b0d7a81613 fix tooling after include reorganization
clangd broke because it can't look through symlinks. compile_commands
manipulation does not fix it, clangd configuration does not fix it, a
vfs overlay does not fix it, and while a combination of those can fix
it with a bind mount in place that's just too cursed to even consider

clangd bug: https://github.com/llvm/llvm-project/issues/116877

Change-Id: I8e3e8489548eb3a7aa65ac9d12a5ec8abf814aec
2024-11-19 22:55:32 +00:00

23 lines
718 B
C++

#pragma once
/// @file Defines C++ 20 concepts that std doesn't have.
#include <type_traits>
namespace nix
{
/// Like std::invocable<>, but also constrains the return type as well.
///
/// Somehow, there is no std concept to do this, even though there is a type trait
/// for it.
///
/// @tparam CallableT The type you want to constrain to be callable, and to return
/// @p ReturnT when called with @p Args as arguments.
///
/// @tparam ReturnT The type the callable should return when called.
/// @tparam Args The arguments the callable should accept to return @p ReturnT.
template<typename CallableT, typename ReturnT, typename ...Args>
concept InvocableR = std::is_invocable_r_v<ReturnT, CallableT, Args...>;
}