37 lines
		
	
	
		
			713 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			713 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								#pragma once
							 | 
						||
| 
								 | 
							
								#include <utility>
							 | 
						||
| 
								 | 
							
								#include "casts.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma warning(disable:4312)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace meta
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
									template<typename T, typename U>
							 | 
						||
| 
								 | 
							
									constexpr T s_cast(U&& rhs) noexcept
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return static_cast<T>(std::forward<U>(rhs));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									template<typename T, typename U>
							 | 
						||
| 
								 | 
							
									constexpr T d_cast(U&& rhs) noexcept
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return dynamic_cast<T>(std::forward<U>(rhs));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									template<typename T, typename U>
							 | 
						||
| 
								 | 
							
									constexpr T r_cast(U&& rhs) noexcept
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return reinterpret_cast<T>(std::forward<U>(rhs));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									template<typename T, typename U>
							 | 
						||
| 
								 | 
							
									constexpr T c_cast(U&& rhs) noexcept
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return const_cast<T>(std::forward<U>(rhs));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									template<typename T>
							 | 
						||
| 
								 | 
							
									constexpr auto&& fwd(T&& fwdee) noexcept
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return static_cast<T&&>(fwdee);
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |