1 #ifndef SIPLASPLAS_TYPEERASURE_ANYARG_HPP 2 #define SIPLASPLAS_TYPEERASURE_ANYARG_HPP 4 #include "simpleany.hpp" 5 #include <siplasplas/utility/universal_reference.hpp> 37 template<
typename T,
typename = std::enable_if_t<
44 _typeProperties[0] = std::is_lvalue_reference<T>::value;
45 _typeProperties[1] = std::is_const<std::remove_reference_t<T>>::value;
46 _typeProperties[2] =
false;
50 _universalRef{cpp::SimpleAny32::create<cpp::ReferenceSimpleAny>(reference)}
52 _typeProperties[0] =
true;
53 _typeProperties[1] =
false;
54 _typeProperties[2] =
true;
58 _universalRef{cpp::SimpleAny32::create<cpp::ConstReferenceSimpleAny>(reference)}
60 _typeProperties[0] =
true;
61 _typeProperties[1] =
true;
62 _typeProperties[2] =
true;
136 throw std::runtime_error{
"Cannot get a non-const reference to a const argument"};
150 return !_typeProperties[0];
158 return _typeProperties[0];
166 return _typeProperties[1];
171 std::bitset<3> _typeProperties;
173 bool isReferenceAny()
const 175 return _typeProperties[2];
181 #endif // SIPLASPLAS_TYPEERASURE_ANYARG_HPP auto universalReference(T &&value) -> UniversalReference< std::decay_t< T >, std::is_lvalue_reference< T >::value, std::is_const< std::remove_reference_t< T >>::value >
Creates an universal reference to the given value.
Definition: universal_reference.hpp:139
cpp::SimpleAny specialization for non-owning const references to existing objects. See cpp::ConstNonOwningStorage
Definition: simpleany.hpp:41
Definition: canary_allocator.hpp:7
AnyArg(T &&value)
Initializes an AnyArg object with a given value.
Definition: anyarg.hpp:41
bool isLvalue() const
Checks if the argument was an lvalue.
Definition: anyarg.hpp:156
Implements a copyable wrapper of an universal reference.
Definition: universal_reference.hpp:31
cpp::SimpleAny specialization for non-owning references to existing objects. See cpp::NonOwningStorag...
Definition: simpleany.hpp:162
Implements a type-erased value container with minimal value semantics requirements.
Definition: simpleany.hpp:15
const std::decay_t< T > & get() const
Returns a readonly reference to the hosted object.
Definition: simpleany.hpp:472
bool isConst() const
Checks if the argument was const.
Definition: anyarg.hpp:164
Represents a type erased function call argument.
Definition: anyarg.hpp:31
bool isRvalue() const
Checks if the argument was an rvalue.
Definition: anyarg.hpp:148