Added base_from_member specialization for members of lvalue-reference type

This commit is contained in:
K-ballo committed 2014-06-11 18:55:12 -03:00
1 parent 61d07273fc
commit 51e482edfe
4 files changed
+56

No files matched your search

+13
View File
@@ -143,6 +143,16 @@ type does not need to concern itself with the integer.
#endif
};
template < typename MemberType, int UniqueID >
class base_from_member<MemberType&, UniqueID>
{
protected:
MemberType& member;
explicit constexpr base_from_member( MemberType& x )
noexcept;
};
The class template has a first template parameter `MemberType` representing
the type of the based-member. It has a last template parameter `UniqueID`,
that is an `int`, to differentiate between multiple base classes that use
@@ -169,6 +179,9 @@ constructor member templates. These constructor templates can take as many
arguments (currently up to ten) as possible and pass them to a constructor
of the data member.
A specialization for member references offers a single constructor taking
a `MemberType&`, which is the only way to initialize a reference.
Since C++ does not allow any way to explicitly state the template parameters
of a templated constructor, make sure that the arguments are already close
as possible to the actual type used in the data member's desired constructor.