Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

23 lines
483 B
C++

/*
* Copyright (c) 2014 Eran Pe'er.
*
* This program is made available under the terms of the MIT License.
*
* Created on Mar 10, 2014
*/
#pragma once
namespace fakeit {
template<typename TARGET, typename SOURCE>
TARGET union_cast(SOURCE source) {
//static_assert(sizeof(TARGET) == sizeof(SOURCE), "can't convert");
union {
SOURCE source;
TARGET target;
} u;
u.source = source;
return u.target;
}
}