2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2019-01-07 08:47:17 +00:00
|
|
|
Copyright (c) 2011-2019 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2016-08-14 07:02:23 +00:00
|
|
|
#ifndef SPROUT_RATIONAL_LITERALS_HPP
|
|
|
|
#define SPROUT_RATIONAL_LITERALS_HPP
|
2013-04-14 07:51:19 +00:00
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/rational/rational.hpp>
|
2016-08-14 07:02:23 +00:00
|
|
|
#include <sprout/detail/udl_namespace.hpp>
|
2013-04-14 07:51:19 +00:00
|
|
|
|
|
|
|
#if SPROUT_USE_USER_DEFINED_LITERALS
|
|
|
|
|
|
|
|
namespace sprout {
|
2016-08-14 07:02:23 +00:00
|
|
|
namespace literals {
|
2013-04-14 07:51:19 +00:00
|
|
|
namespace rational {
|
|
|
|
//
|
|
|
|
// _r
|
|
|
|
//
|
|
|
|
inline SPROUT_CONSTEXPR sprout::rational<int>
|
|
|
|
operator"" _r(unsigned long long x) {
|
2015-12-09 10:54:35 +00:00
|
|
|
return sprout::rational<int>(static_cast<int>(x));
|
2013-04-14 07:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// _rl
|
|
|
|
// _rL
|
|
|
|
//
|
|
|
|
inline SPROUT_CONSTEXPR sprout::rational<long>
|
|
|
|
operator"" _rl(unsigned long long x) {
|
2015-12-09 10:54:35 +00:00
|
|
|
return sprout::rational<long>(static_cast<long>(x));
|
2013-04-14 07:51:19 +00:00
|
|
|
}
|
|
|
|
inline SPROUT_CONSTEXPR sprout::rational<long>
|
|
|
|
operator"" _rL(unsigned long long x) {
|
2015-12-09 10:54:35 +00:00
|
|
|
return sprout::rational<long>(static_cast<long>(x));
|
2013-04-14 07:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// _rll
|
|
|
|
// _rLL
|
|
|
|
//
|
|
|
|
inline SPROUT_CONSTEXPR sprout::rational<long long>
|
|
|
|
operator"" _rll(unsigned long long x) {
|
|
|
|
return sprout::rational<long long>(x);
|
|
|
|
}
|
|
|
|
inline SPROUT_CONSTEXPR sprout::rational<long long>
|
|
|
|
operator"" _rLL(unsigned long long x) {
|
|
|
|
return sprout::rational<long long>(x);
|
|
|
|
}
|
|
|
|
} // namespace rational
|
|
|
|
|
2016-08-14 07:02:23 +00:00
|
|
|
using sprout::literals::rational::operator"" _r;
|
|
|
|
using sprout::literals::rational::operator"" _rl;
|
|
|
|
using sprout::literals::rational::operator"" _rL;
|
|
|
|
using sprout::literals::rational::operator"" _rll;
|
|
|
|
using sprout::literals::rational::operator"" _rLL;
|
|
|
|
} // namespace literals
|
2013-04-14 07:51:19 +00:00
|
|
|
|
2016-08-14 07:02:23 +00:00
|
|
|
using sprout::literals::rational::operator"" _r;
|
|
|
|
using sprout::literals::rational::operator"" _rl;
|
|
|
|
using sprout::literals::rational::operator"" _rL;
|
|
|
|
using sprout::literals::rational::operator"" _rll;
|
|
|
|
using sprout::literals::rational::operator"" _rLL;
|
2013-04-14 07:51:19 +00:00
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS
|
|
|
|
|
2016-08-14 07:02:23 +00:00
|
|
|
#endif // #ifndef SPROUT_RATIONAL_LITERALS_HPP
|