1 // Copyright 2016 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #pragma once 6 7 namespace internal { 8 9 // type_size<T>() is 1 if T is (const/volatile) void or sizeof(T) otherwise. type_size()10template <typename T> inline constexpr size_t type_size() { return sizeof(T); } 11 template <> inline constexpr size_t type_size<void>() { return 1u; } 12 template <> inline constexpr size_t type_size<const void>() { return 1u; } 13 template <> inline constexpr size_t type_size<volatile void>() { return 1u; } 14 template <> inline constexpr size_t type_size<const volatile void>() { return 1u; } 15 16 } // namespace internal 17