-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathvtable.fail.1.cpp
33 lines (27 loc) · 931 Bytes
/
vtable.fail.1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Louis Dionne 2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <dyno/concept.hpp>
#include <dyno/concept_map.hpp>
#include <dyno/vtable.hpp>
using namespace dyno::literals;
struct Fooable : decltype(dyno::requires(
"a"_s = dyno::function<void (dyno::T&)>,
"b"_s = dyno::function<void (dyno::T&)>
)) { };
template <>
auto dyno::concept_map<Fooable, int> = dyno::make_concept_map(
"a"_s = [](int&) { },
"b"_s = [](int&) { }
);
int main() {
using VTable = dyno::vtable<
dyno::local<dyno::only<"a"_s>>,
dyno::remote<dyno::only<"b"_s>>
>;
VTable::apply<Fooable> vtable{
dyno::complete_concept_map<Fooable, int>(dyno::concept_map<Fooable, int>)
};
// MESSAGE[Request for a virtual function that is not present in any of the joined vtables]
auto fail = vtable["inexistent"_s];
}