util/Cast: make the "member" pointer const

This commit is contained in:
Max Kellermann 2017-09-13 10:32:55 +02:00
parent 3b7f9827ab
commit 101f08ca75

View File

@ -85,7 +85,7 @@ ContainerAttributeOffset(const A C::*p)
*/ */
template<class C, class A> template<class C, class A>
static inline constexpr C & static inline constexpr C &
ContainerCast(A &a, A C::*member) ContainerCast(A &a, const A C::*member)
{ {
return *OffsetCast<C, A>(&a, ContainerAttributeOffset<C, A>(member)); return *OffsetCast<C, A>(&a, ContainerAttributeOffset<C, A>(member));
} }
@ -95,7 +95,7 @@ ContainerCast(A &a, A C::*member)
*/ */
template<class C, class A> template<class C, class A>
static inline constexpr const C & static inline constexpr const C &
ContainerCast(const A &a, A C::*member) ContainerCast(const A &a, const A C::*member)
{ {
return *OffsetCast<const C, const A>(&a, ContainerAttributeOffset<C, A>(member)); return *OffsetCast<const C, const A>(&a, ContainerAttributeOffset<C, A>(member));
} }