From 47c912e5e22f728e978464129b1739cc532012f5 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 1 Aug 2018 13:10:11 +1000 Subject: [PATCH] view: avoid alignment warnings for view extraction It is assumed the user is on top of this. --- view.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/view.hpp b/view.hpp index cfe5f081..c64e484a 100644 --- a/view.hpp +++ b/view.hpp @@ -621,6 +621,8 @@ namespace util { /// /// the buffer object is advanced in place so that it no longer covers /// the extract value + /// + /// it is assumed the user has taken care of alignment concerns template < typename ValueT, typename ByteT, @@ -632,7 +634,7 @@ namespace util { if (buffer.size () < sizeof (ValueT)) throw std::runtime_error ("insufficient data for view shift"); - ValueT const &res = *reinterpret_cast (buffer.data ()); + ValueT const &res = *util::cast::ffs (buffer.data ()); buffer = buffer.consume (sizeof (ValueT)); return res; }