Adobe Source Libraries 2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
poly_regular.hpp
Go to the documentation of this file.
1/*
2 Copyright 2006-2007 Adobe Systems Incorporated
3 Distributed under the Boost Software License - Version 1.0 (see the accompanying file LICENSE
4 or a copy at https://stlab.github.io/adobe_source_libraries/licenses.html)
5
6 Author(s): Mat Marcus
7*/
8
9/**************************************************************************************************/
10
11#ifndef ADOBE_POLY_REGULAR_HPP
12#define ADOBE_POLY_REGULAR_HPP
13
14#include <adobe/config.hpp>
15
16#include <utility>
17
18#include <boost/concept_check.hpp>
19
20#include <adobe/empty.hpp>
21#include <adobe/poly.hpp>
23
24/**************************************************************************************************/
25
26namespace adobe {
27
31
32/**************************************************************************************************/
37
39 virtual bool equals(const poly_regular_interface& new_value) const = 0;
40};
41
42/**************************************************************************************************/
43
50
51template <typename T>
52struct poly_regular_instance : optimized_storage_type<T, poly_regular_interface>::type {
54
59
63 poly_regular_instance(const T& x) : base_t(x) {}
64
68 poly_regular_instance(poly_regular_instance&& x) noexcept : base_t(std::move(x)) {}
69
70 bool equals(const poly_regular_interface& x) const {
71 return this->type_info() == x.type_info() &&
72 this->get() == *static_cast<const T*>(x.cast());
73 }
74};
75
76/**************************************************************************************************/
77
83
84struct regular : poly_base<poly_regular_interface, poly_regular_instance> {
86
90 template <typename T>
91 explicit regular(const T& s) : base_t(s) {}
92
94
98 regular(regular&& x) noexcept : base_t(std::move(x)) {}
99};
100
101
102/**************************************************************************************************/
103
104#if !defined(ADOBE_NO_DOCUMENTATION)
105
106/**************************************************************************************************/
107
109
110/**************************************************************************************************/
111
112#endif
113
114/**************************************************************************************************/
115
116} // namespace adobe
117
118/**************************************************************************************************/
119
120#endif
poly<foo> will be a runtime polymorphic value type wrapper modelling a concept represented by foo
Definition poly.hpp:406
poly< regular > poly_regular_t
Authors of poly concept representatives must derive their instance class from this....
Definition poly.hpp:241
Abstract interface providing signatures needed to implement "handle" objects modeling a Value (Copyab...
Definition poly.hpp:64
virtual const std::type_info & type_info() const =0
bool equals(const poly_regular_interface &x) const
BOOST_CLASS_REQUIRE(T, adobe, RegularConcept)
optimized_storage_type< T, poly_regular_interface >::type base_t
poly_regular_instance(poly_regular_instance &&x) noexcept
Virtual interface for RegularConcept. Used in poly<regular> implementation.
virtual bool equals(const poly_regular_interface &new_value) const =0
poly_base< poly_regular_interface, poly_regular_instance > base_t
regular(const T &s)
regular(regular &&x) noexcept
An empty regular- and less-than-comparable- type.
Definition empty.hpp:42