Changeset - r23641:bcbf9c9bc8b1
[Not reviewed]
master
0 1 0
peter1138 - 5 years ago 2019-04-21 20:48:08
peter1138@openttd.org
Codechange: Use std::underlying_type for DECLARE_POSTFIX_INCREMENT.
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/core/enum_type.hpp
Show inline comments
 
@@ -13,17 +13,17 @@
 
#define ENUM_TYPE_HPP
 

	
 
/** Some enums need to have allowed incrementing (i.e. StationClassID) */
 
#define DECLARE_POSTFIX_INCREMENT(type) \
 
	inline type operator ++(type& e, int) \
 
#define DECLARE_POSTFIX_INCREMENT(enum_type) \
 
	inline enum_type operator ++(enum_type& e, int) \
 
	{ \
 
		type e_org = e; \
 
		e = (type)((int)e + 1); \
 
		enum_type e_org = e; \
 
		e = (enum_type)((std::underlying_type<enum_type>::type)e + 1); \
 
		return e_org; \
 
	} \
 
	inline type operator --(type& e, int) \
 
	inline enum_type operator --(enum_type& e, int) \
 
	{ \
 
		type e_org = e; \
 
		e = (type)((int)e - 1); \
 
		enum_type e_org = e; \
 
		e = (enum_type)((std::underlying_type<enum_type>::type)e - 1); \
 
		return e_org; \
 
	}
 

	
0 comments (0 inline, 0 general)