/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License Version 2.0 with LLVM Exceptions * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * https://llvm.org/LICENSE.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #include #include namespace unifex { namespace _overload { template struct _cpo_t { struct type; }; // This type will have the associated namespaces // of CPO (by inheritance) but not those of Sig. template struct _cpo_t::type : CPO { constexpr type() = default; constexpr type(CPO) noexcept {} using base_cpo_t = CPO; using type_erased_signature_t = Sig; }; template struct base_cpo { using type = CPO; }; template struct base_cpo> { using type = typename CPO::base_cpo_t; }; template inline constexpr typename _cpo_t::type _cpo{}; template struct _sig {}; } // namespace _overload template inline constexpr _overload::_sig const sig{}; template using base_cpo_t = typename _overload::base_cpo::type; template using overload_t = typename _overload::_cpo_t, Sig>::type; template constexpr typename _overload::_cpo_t::type const& overload(CPO const&, _overload::_sig = {}) noexcept { return _overload::_cpo; } } // namespace unifex #include