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
>::type
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};
return result;
#else
@ -73,7 +73,7 @@ namespace sprout {
typename sprout::detail::div_t_traits2<T>::type
>::type
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};
return result;
#else

View file

@ -8,7 +8,11 @@
#ifndef 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
# define SPROUT_NO_CXX11_DEFAULTED_FUNCTIONS
# define SPROUT_NO_CXX11_DELETED_FUNCTIONS

View file

@ -17,11 +17,19 @@
//
#ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR
# define SPROUT_CONSTEXPR constexpr
# define SPROUT_CONSTEXPR_OR_CONST constexpr
# define SPROUT_STATIC_CONSTEXPR static constexpr
# ifndef SPROUT_NO_STATIC_CONSTEXPR_INITIALIZATION
# 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_OUTER(EXPR)
# define SPROUT_STATIC_CONSTEXPR_DATA_MEMBER_INNER(EXPR) = 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
# define SPROUT_CONSTEXPR
# define SPROUT_CONSTEXPR_OR_CONST const

View file

@ -56,7 +56,7 @@ namespace sprout {
typename sprout::detail::div_t_traits<T>::type
>::type
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};
return result;
#else

View file

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