1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

partial support (C++11 constexpr) for VC++2015

This commit is contained in:
bolero-MURAKAMI 2016-02-12 21:06:06 +09:00
parent b1b62d9a29
commit e7a79b31ea
5 changed files with 21 additions and 9 deletions

View file

@ -59,7 +59,7 @@ namespace sprout {
typename sprout::detail::div_t_traits2<T>::type typename sprout::detail::div_t_traits2<T>::type
>::type >::type
div_impl2(T const& numer, T const& denom) { div_impl2(T const& numer, T const& denom) {
#if defined(_MSC_VER) #if defined(_MSC_VER) && (_MSC_VER > 1900)
typename sprout::detail::div_t_traits2<T>::type result = {numer / denom, numer % denom}; typename sprout::detail::div_t_traits2<T>::type result = {numer / denom, numer % denom};
return result; return result;
#else #else
@ -73,7 +73,7 @@ namespace sprout {
typename sprout::detail::div_t_traits2<T>::type typename sprout::detail::div_t_traits2<T>::type
>::type >::type
div_impl2(T const& numer, T const& denom) { div_impl2(T const& numer, T const& denom) {
#if defined(_MSC_VER) #if defined(_MSC_VER) && (_MSC_VER > 1900)
typename sprout::detail::div_t_traits2<T>::type result = {numer % denom, numer / denom}; typename sprout::detail::div_t_traits2<T>::type result = {numer % denom, numer / denom};
return result; return result;
#else #else

View file

@ -8,7 +8,11 @@
#ifndef SPROUT_CONFIG_COMPILER_VISUALC_HPP #ifndef SPROUT_CONFIG_COMPILER_VISUALC_HPP
#define SPROUT_CONFIG_COMPILER_VISUALC_HPP #define SPROUT_CONFIG_COMPILER_VISUALC_HPP
#define SPROUT_NO_CXX11_CONSTEXPR #if _MSC_FULL_VER < 190023026
# define SPROUT_NO_CXX11_CONSTEXPR
#endif
#define SPROUT_NO_STATIC_CONSTEXPR_INITIALIZATION
#if _MSC_FULL_VER < 180020827 #if _MSC_FULL_VER < 180020827
# define SPROUT_NO_CXX11_DEFAULTED_FUNCTIONS # define SPROUT_NO_CXX11_DEFAULTED_FUNCTIONS
# define SPROUT_NO_CXX11_DELETED_FUNCTIONS # define SPROUT_NO_CXX11_DELETED_FUNCTIONS

View file

@ -17,11 +17,19 @@
// //
#ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR #ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR
# define SPROUT_CONSTEXPR constexpr # define SPROUT_CONSTEXPR constexpr
# define SPROUT_CONSTEXPR_OR_CONST constexpr # ifndef SPROUT_NO_STATIC_CONSTEXPR_INITIALIZATION
# define SPROUT_STATIC_CONSTEXPR static constexpr # define SPROUT_CONSTEXPR_OR_CONST constexpr
# define SPROUT_STATIC_CONSTEXPR static constexpr
# #
# define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(EXPR) = EXPR # define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(EXPR) = EXPR
# define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(EXPR) # define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(EXPR)
# else
# define SPROUT_CONSTEXPR_OR_CONST const
# define SPROUT_STATIC_CONSTEXPR static const
#
# define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(EXPR)
# define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_OUTER(EXPR) = EXPR
# endif
#else // #ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR #else // #ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR
# define SPROUT_CONSTEXPR # define SPROUT_CONSTEXPR
# define SPROUT_CONSTEXPR_OR_CONST const # define SPROUT_CONSTEXPR_OR_CONST const

View file

@ -56,7 +56,7 @@ namespace sprout {
typename sprout::detail::div_t_traits<T>::type typename sprout::detail::div_t_traits<T>::type
>::type >::type
div_impl(T const& numer, T const& denom) { div_impl(T const& numer, T const& denom) {
#if defined(_MSC_VER) #if defined(_MSC_VER) && (_MSC_VER > 1900)
typename sprout::detail::div_t_traits<T>::type result = {numer / denom, numer % denom}; typename sprout::detail::div_t_traits<T>::type result = {numer / denom, numer % denom};
return result; return result;
#else #else

View file

@ -23,7 +23,7 @@
namespace sprout { namespace sprout {
namespace types { namespace types {
#ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR #if !defined(SPROUT_CONFIG_DISABLE_CONSTEXPR) && !defined(SPROUT_NO_STATIC_CONSTEXPR_INITIALIZATION)
// //
// to_string // to_string
// //