From e2dc6538638c009773f7de35bceed4837b7a295c Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Thu, 8 Sep 2016 12:44:29 +0200 Subject: [PATCH] Add static assertions on the size of expected --- tstl/include/expected.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tstl/include/expected.hpp b/tstl/include/expected.hpp index 21dbfd1f..592a0080 100644 --- a/tstl/include/expected.hpp +++ b/tstl/include/expected.hpp @@ -559,6 +559,10 @@ inline expected make_expected(){ return expected(); } +// Make sure the size is maintained reasonable +static_assert(sizeof(expected) == 2 * sizeof(size_t), "expected should not have overhead"); +static_assert(sizeof(expected) == 2 * sizeof(size_t), "expected should not have overhead"); + } //end of namespace std #endif