@@ -27,13 +27,13 @@ using namespace dyno::literals;
27
27
28
28
// Define the interface of something that can be drawn
29
29
struct Drawable : decltype(dyno::requires(
30
- "draw"_ s = dyno::method<void (std::ostream&) const>
30
+ "draw"_ dyno = dyno::method<void (std::ostream&) const>
31
31
) ) { };
32
32
33
33
// Define how concrete types can fulfill that interface
34
34
template <typename T >
35
35
auto const dyno::default_concept_map<Drawable, T> = dyno::make_concept_map(
36
- "draw"_ s = [ ] (T const& self, std::ostream& out) { self.draw(out); }
36
+ "draw"_ dyno = [ ] (T const& self, std::ostream& out) { self.draw(out); }
37
37
);
38
38
39
39
// Define an object that can hold anything that can be drawn.
@@ -42,7 +42,7 @@ struct drawable {
42
42
drawable (T x) : poly_ {x} { }
43
43
44
44
void draw(std::ostream& out) const
45
- { poly_ .virtual_ ("draw"_ s )(out); }
45
+ { poly_ .virtual_ ("draw"_ dyno )(out); }
46
46
47
47
private:
48
48
dyno::poly<Drawable > poly_ ;
@@ -237,7 +237,7 @@ let's define an interface `Drawable` that describes types that can be drawn:
237
237
using namespace dyno::literals;
238
238
239
239
struct Drawable : decltype(dyno::requires(
240
- "draw"_s = dyno::method<void (std::ostream&) const>
240
+ "draw"_dyno = dyno::method<void (std::ostream&) const>
241
241
)) { };
242
242
```
243
243
@@ -273,7 +273,7 @@ struct Square { /* ... */ };
273
273
274
274
template <>
275
275
auto const dyno::concept_map<Drawable, Square> = dyno::make_concept_map(
276
- "draw"_ s = [ ] (Square const& square, std::ostream& out) {
276
+ "draw"_ dyno = [ ] (Square const& square, std::ostream& out) {
277
277
out << "square" << std::endl;
278
278
}
279
279
);
@@ -319,7 +319,7 @@ struct drawable {
319
319
drawable(T x) : poly_{x} { }
320
320
321
321
void draw(std::ostream& out) const
322
- { poly_.virtual_("draw"_s )(out); }
322
+ { poly_.virtual_("draw"_dyno )(out); }
323
323
324
324
private:
325
325
dyno::poly<Drawable> poly_;
@@ -356,7 +356,7 @@ of the `draw` method:
356
356
357
357
```c++
358
358
void draw(std::ostream& out) const
359
- { poly_.virtual_("draw"_s )(out); }
359
+ { poly_.virtual_("draw"_dyno )(out); }
360
360
```
361
361
362
362
What happens here is that when ` .draw ` is called on our ` drawable ` object,
@@ -414,7 +414,7 @@ struct drawable {
414
414
drawable(T x) : poly_ {x} { }
415
415
416
416
void draw(std::ostream& out) const
417
- { poly_ .virtual_ ("draw"_ s )(out); }
417
+ { poly_ .virtual_ ("draw"_ dyno )(out); }
418
418
419
419
private:
420
420
dyno::poly<Drawable, dyno::sbo_storage<16>> poly_ ;
@@ -465,7 +465,7 @@ struct drawable {
465
465
drawable(T x) : poly_{x} { }
466
466
467
467
void draw(std::ostream& out) const
468
- { poly_.virtual_("draw"_s )(out); }
468
+ { poly_.virtual_("draw"_dyno )(out); }
469
469
470
470
private:
471
471
using Storage = dyno::sbo_storage<16>; // storage policy
@@ -490,12 +490,12 @@ struct drawable {
490
490
drawable(T x) : poly_ {x} { }
491
491
492
492
void draw(std::ostream& out) const
493
- { poly_ .virtual_ ("draw"_ s )(out); }
493
+ { poly_ .virtual_ ("draw"_ dyno )(out); }
494
494
495
495
private:
496
496
using Storage = dyno::sbo_storage<16>;
497
497
using VTable = dyno::vtable<
498
- dyno::local< dyno::only<decltype("draw"_s ) > >,
498
+ dyno::local< dyno::only<decltype("draw"_dyno ) > >,
499
499
dyno::remote< dyno::everything_else >
500
500
> ;
501
501
dyno::poly<Drawable, Storage, VTable> poly_ ;
@@ -523,7 +523,7 @@ For this, one can use `dyno::default_concept_map`:
523
523
```c++
524
524
template <typename T>
525
525
auto const dyno::default_concept_map<Drawable, T> = dyno::make_concept_map(
526
- "draw"_s = [](auto const& self, std::ostream& out) { self.draw(out); }
526
+ "draw"_dyno = [](auto const& self, std::ostream& out) { self.draw(out); }
527
527
);
528
528
```
529
529
@@ -549,7 +549,7 @@ default one:
549
549
```c++
550
550
template <>
551
551
auto dyno::concept_map<Drawable, Circle> = dyno::make_concept_map(
552
- "draw"_s = [](Circle const& circle, std::ostream& out) {
552
+ "draw"_dyno = [](Circle const& circle, std::ostream& out) {
553
553
out << "triangle" << std::endl;
554
554
}
555
555
);
@@ -569,7 +569,7 @@ template <typename T>
569
569
auto const dyno::concept_map<Drawable, std::vector<T>, std::void_t <decltype (
570
570
std::cout << std::declval<T>()
571
571
)>> = dyno::make_concept_map(
572
- " draw" _s = [](std::vector<T> const & v, std::ostream& out) {
572
+ " draw" _dyno = [](std::vector<T> const & v, std::ostream& out) {
573
573
for (auto const& x : v)
574
574
out << x << ' ';
575
575
}
@@ -591,7 +591,7 @@ the concept using `dyno::function` instead of `dyno::method`, and use the
591
591
```c++
592
592
// Define the interface of something that can be drawn
593
593
struct Drawable : decltype(dyno::requires(
594
- "draw"_s = dyno::function<void (dyno::T const&, std::ostream&)>
594
+ "draw"_dyno = dyno::function<void (dyno::T const&, std::ostream&)>
595
595
)) { };
596
596
```
597
597
@@ -601,7 +601,7 @@ first parameter:
601
601
602
602
``` c++
603
603
struct Drawable : decltype(dyno::requires(
604
- "draw"_ s = dyno::function<void (std::ostream&, dyno::T const&)>
604
+ "draw"_ dyno = dyno::function<void (std::ostream&, dyno::T const&)>
605
605
)) { };
606
606
```
607
607
@@ -613,7 +613,7 @@ implementation match that of the function declared in the concept:
613
613
// Define how concrete types can fulfill that interface
614
614
template <typename T>
615
615
auto const dyno::default_concept_map<Drawable, T> = dyno::make_concept_map(
616
- "draw"_s = [](std::ostream& out, T const& self) { self.draw(out); }
616
+ "draw"_dyno = [](std::ostream& out, T const& self) { self.draw(out); }
617
617
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ matches the concept definition
618
618
);
619
619
```
@@ -630,7 +630,7 @@ struct drawable {
630
630
drawable(T x) : poly_ {x} { }
631
631
632
632
void draw(std::ostream& out) const
633
- { poly_ .virtual_ ("draw"_ s )(out, poly_ ); }
633
+ { poly_ .virtual_ ("draw"_ dyno )(out, poly_ ); }
634
634
// ^^^^^ passing the poly explicitly
635
635
636
636
private:
0 commit comments