1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-02-04 21:33:56 +00:00

rename */udl.hpp -> literals.hpp [destructive]

This commit is contained in:
bolero-MURAKAMI 2016-08-14 16:02:23 +09:00
parent fea5e752bd
commit 92c7169221
22 changed files with 259 additions and 145 deletions

View file

@ -18,7 +18,7 @@
#include <sprout/complex/tuple.hpp> #include <sprout/complex/tuple.hpp>
#include <sprout/complex/container.hpp> #include <sprout/complex/container.hpp>
#include <sprout/complex/nearest.hpp> #include <sprout/complex/nearest.hpp>
#include <sprout/complex/udl.hpp> #include <sprout/complex/literals.hpp>
#include <sprout/complex/type_traits.hpp> #include <sprout/complex/type_traits.hpp>
#endif // #ifndef SPROUT_COMPLEX_HPP #endif // #ifndef SPROUT_COMPLEX_HPP

View file

@ -5,16 +5,17 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_COMPLEX_UDL_HPP #ifndef SPROUT_COMPLEX_LITERALS_HPP
#define SPROUT_COMPLEX_UDL_HPP #define SPROUT_COMPLEX_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/complex/complex.hpp> #include <sprout/complex/complex.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
namespace sprout { namespace sprout {
namespace udl { namespace literals {
namespace complex { namespace complex {
// //
// _i // _i
@ -51,20 +52,20 @@ namespace sprout {
} }
} // namespace complex } // namespace complex
using sprout::udl::complex::operator"" _i; using sprout::literals::complex::operator"" _i;
using sprout::udl::complex::operator"" _if; using sprout::literals::complex::operator"" _if;
using sprout::udl::complex::operator"" _iF; using sprout::literals::complex::operator"" _iF;
using sprout::udl::complex::operator"" _il; using sprout::literals::complex::operator"" _il;
using sprout::udl::complex::operator"" _iL; using sprout::literals::complex::operator"" _iL;
} // namespace udl } // namespace literals
using sprout::udl::complex::operator"" _i; using sprout::literals::complex::operator"" _i;
using sprout::udl::complex::operator"" _if; using sprout::literals::complex::operator"" _if;
using sprout::udl::complex::operator"" _iF; using sprout::literals::complex::operator"" _iF;
using sprout::udl::complex::operator"" _il; using sprout::literals::complex::operator"" _il;
using sprout::udl::complex::operator"" _iL; using sprout::literals::complex::operator"" _iL;
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_COMPLEX_UDL_HPP #endif // #ifndef SPROUT_COMPLEX_LITERALS_HPP

View file

@ -1,15 +1,15 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2011-2016 Bolero MURAKAMI Copyright (c) 2011-2016 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_COMPLEX_OPERATORS_HPP #ifndef SPROUT_COMPLEX_OPERATORS_HPP
#define SPROUT_COMPLEX_OPERATORS_HPP #define SPROUT_COMPLEX_OPERATORS_HPP
#include <sprout/complex/arithmetic_operators.hpp> #include <sprout/complex/arithmetic_operators.hpp>
#include <sprout/complex/stream_operators.hpp> #include <sprout/complex/stream_operators.hpp>
#endif // #ifndef SPROUT_COMPLEX_OPERATORS_HPP #endif // #ifndef SPROUT_COMPLEX_OPERATORS_HPP

15
sprout/cstddef.hpp Normal file
View file

@ -0,0 +1,15 @@
/*=============================================================================
Copyright (c) 2011-2016 Bolero MURAKAMI
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)
=============================================================================*/
#ifndef SPROUT_CSTDDEF_HPP
#define SPROUT_CSTDDEF_HPP
#include <sprout/config.hpp>
#include <sprout/workaround/std/cstddef.hpp>
#include <sprout/cstddef/literals.hpp>
#endif // #ifndef SPROUT_CSTDDEF_HPP

View file

@ -0,0 +1,34 @@
/*=============================================================================
Copyright (c) 2011-2016 Bolero MURAKAMI
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)
=============================================================================*/
#ifndef SPROUT_CSTDDEF_LITERALS_HPP
#define SPROUT_CSTDDEF_LITERALS_HPP
#include <sprout/config.hpp>
#include <sprout/workaround/std/cstddef.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS
namespace sprout {
namespace literals {
namespace support_literals {
//
// operator"" _zu
//
SPROUT_CONSTEXPR std::size_t operator"" _zu(unsigned long long t) {
return static_cast<std::size_t>(t);
}
} // namespace support_literals
using sprout::literals::support_literals::operator"" _zu;
} // namespace literals
} // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_CSTDDEF_LITERALS_HPP

View file

@ -0,0 +1,20 @@
/*=============================================================================
Copyright (c) 2011-2016 Bolero MURAKAMI
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)
=============================================================================*/
#ifndef SPROUT_DETAIL_UDL_NAMESPACE_HPP
#define SPROUT_DETAIL_UDL_NAMESPACE_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace literals {
} // namespace literals
namespace udl = sprout::literals;
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_UDL_NAMESPACE_HPP

View file

@ -11,6 +11,6 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/functional/bind/bind.hpp> #include <sprout/functional/bind/bind.hpp>
#include <sprout/functional/bind/placeholder.hpp> #include <sprout/functional/bind/placeholder.hpp>
#include <sprout/functional/bind/udl.hpp> #include <sprout/functional/bind/literals.hpp>
#endif // #ifndef SPROUT_FUNCTIONAL_BIND_HPP #endif // #ifndef SPROUT_FUNCTIONAL_BIND_HPP

View file

@ -5,11 +5,12 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_FUNCTIONAL_BIND_UDL_HPP #ifndef SPROUT_FUNCTIONAL_BIND_LITERALS_HPP
#define SPROUT_FUNCTIONAL_BIND_UDL_HPP #define SPROUT_FUNCTIONAL_BIND_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/functional/bind/placeholder.hpp> #include <sprout/functional/bind/placeholder.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
@ -34,7 +35,7 @@ namespace sprout {
> >
{}; {};
namespace udl { namespace literals {
namespace placeholders { namespace placeholders {
// //
// _ // _
@ -54,11 +55,11 @@ namespace sprout {
} }
} // namespace placeholders } // namespace placeholders
using sprout::udl::placeholders::operator"" _; using sprout::literals::placeholders::operator"" _;
using sprout::udl::placeholders::operator"" _tail; using sprout::literals::placeholders::operator"" _tail;
} // namespace udl } // namespace literals
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_FUNCTIONAL_BIND_UDL_HPP #endif // #ifndef SPROUT_FUNCTIONAL_BIND_LITERALS_HPP

View file

@ -5,11 +5,12 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_INDEX_TUPLE_UDL_HPP #ifndef SPROUT_INDEX_TUPLE_LITERALS_HPP
#define SPROUT_INDEX_TUPLE_UDL_HPP #define SPROUT_INDEX_TUPLE_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/index_tuple.hpp> #include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
@ -30,7 +31,7 @@ namespace sprout {
: public sprout::make_uindex_tuple<sprout::detail::digits_to_int<sprout::uindex_t, Chars...>::value> : public sprout::make_uindex_tuple<sprout::detail::digits_to_int<sprout::uindex_t, Chars...>::value>
{}; {};
namespace udl { namespace literals {
namespace indexes { namespace indexes {
// //
// _indexes // _indexes
@ -48,14 +49,14 @@ namespace sprout {
} }
} // namespace indexes } // namespace indexes
using sprout::udl::indexes::operator"" _indexes; using sprout::literals::indexes::operator"" _indexes;
using sprout::udl::indexes::operator"" _uindexes; using sprout::literals::indexes::operator"" _uindexes;
} // namespace udl } // namespace literals
using sprout::udl::indexes::operator"" _indexes; using sprout::literals::indexes::operator"" _indexes;
using sprout::udl::indexes::operator"" _uindexes; using sprout::literals::indexes::operator"" _uindexes;
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_INDEX_TUPLE_UDL_HPP #endif // #ifndef SPROUT_INDEX_TUPLE_LITERALS_HPP

View file

@ -11,6 +11,6 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/make_indexes.hpp> #include <sprout/index_tuple/make_indexes.hpp>
#include <sprout/index_tuple/enable_make_indexes.hpp> #include <sprout/index_tuple/enable_make_indexes.hpp>
#include <sprout/index_tuple/udl.hpp> #include <sprout/index_tuple/literals.hpp>
#endif // #ifndef SPROUT_INDEX_TUPLE_UTILITY_HPP #endif // #ifndef SPROUT_INDEX_TUPLE_UTILITY_HPP

View file

@ -18,7 +18,7 @@
#include <sprout/math/quaternion/hash.hpp> #include <sprout/math/quaternion/hash.hpp>
#include <sprout/math/quaternion/tuple.hpp> #include <sprout/math/quaternion/tuple.hpp>
#include <sprout/math/quaternion/container.hpp> #include <sprout/math/quaternion/container.hpp>
#include <sprout/math/quaternion/udl.hpp> #include <sprout/math/quaternion/literals.hpp>
#include <sprout/math/quaternion/type_traits.hpp> #include <sprout/math/quaternion/type_traits.hpp>
#endif // #ifndef SPROUT_MATH_QUATERNION_HPP #endif // #ifndef SPROUT_MATH_QUATERNION_HPP

View file

@ -5,23 +5,24 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_MATH_QUATERNION_UDL_HPP #ifndef SPROUT_MATH_QUATERNION_LITERALS_HPP
#define SPROUT_MATH_QUATERNION_UDL_HPP #define SPROUT_MATH_QUATERNION_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/complex/udl.hpp> #include <sprout/complex/literals.hpp>
#include <sprout/math/quaternion/quaternion.hpp> #include <sprout/math/quaternion/quaternion.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
namespace sprout { namespace sprout {
namespace udl { namespace literals {
namespace quaternion { namespace quaternion {
using sprout::udl::complex::operator"" _i; using sprout::literals::complex::operator"" _i;
using sprout::udl::complex::operator"" _if; using sprout::literals::complex::operator"" _if;
using sprout::udl::complex::operator"" _iF; using sprout::literals::complex::operator"" _iF;
using sprout::udl::complex::operator"" _il; using sprout::literals::complex::operator"" _il;
using sprout::udl::complex::operator"" _iL; using sprout::literals::complex::operator"" _iL;
// //
// _j // _j
@ -92,32 +93,32 @@ namespace sprout {
} }
} // namespace quaternion } // namespace quaternion
using sprout::udl::quaternion::operator"" _j; using sprout::literals::quaternion::operator"" _j;
using sprout::udl::quaternion::operator"" _jf; using sprout::literals::quaternion::operator"" _jf;
using sprout::udl::quaternion::operator"" _jF; using sprout::literals::quaternion::operator"" _jF;
using sprout::udl::quaternion::operator"" _jl; using sprout::literals::quaternion::operator"" _jl;
using sprout::udl::quaternion::operator"" _jL; using sprout::literals::quaternion::operator"" _jL;
using sprout::udl::quaternion::operator"" _k; using sprout::literals::quaternion::operator"" _k;
using sprout::udl::quaternion::operator"" _kf; using sprout::literals::quaternion::operator"" _kf;
using sprout::udl::quaternion::operator"" _kF; using sprout::literals::quaternion::operator"" _kF;
using sprout::udl::quaternion::operator"" _kl; using sprout::literals::quaternion::operator"" _kl;
using sprout::udl::quaternion::operator"" _kL; using sprout::literals::quaternion::operator"" _kL;
} // namespace udl } // namespace literals
using sprout::udl::quaternion::operator"" _j; using sprout::literals::quaternion::operator"" _j;
using sprout::udl::quaternion::operator"" _jf; using sprout::literals::quaternion::operator"" _jf;
using sprout::udl::quaternion::operator"" _jF; using sprout::literals::quaternion::operator"" _jF;
using sprout::udl::quaternion::operator"" _jl; using sprout::literals::quaternion::operator"" _jl;
using sprout::udl::quaternion::operator"" _jL; using sprout::literals::quaternion::operator"" _jL;
using sprout::udl::quaternion::operator"" _k; using sprout::literals::quaternion::operator"" _k;
using sprout::udl::quaternion::operator"" _kf; using sprout::literals::quaternion::operator"" _kf;
using sprout::udl::quaternion::operator"" _kF; using sprout::literals::quaternion::operator"" _kF;
using sprout::udl::quaternion::operator"" _kl; using sprout::literals::quaternion::operator"" _kl;
using sprout::udl::quaternion::operator"" _kL; using sprout::literals::quaternion::operator"" _kL;
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_MATH_QUATERNION_UDL_HPP #endif // #ifndef SPROUT_MATH_QUATERNION_LITERALS_HPP

View file

@ -18,6 +18,7 @@
#include <sprout/generator/functions.hpp> #include <sprout/generator/functions.hpp>
#include <sprout/random/random_result_fwd.hpp> #include <sprout/random/random_result_fwd.hpp>
#include <sprout/random/variate_generator.hpp> #include <sprout/random/variate_generator.hpp>
#include <sprout/random/detail/ptr_helper.hpp>
#include <sprout/utility/swap.hpp> #include <sprout/utility/swap.hpp>
#include <sprout/utility/move.hpp> #include <sprout/utility/move.hpp>
#include <sprout/type_traits/integral_constant.hpp> #include <sprout/type_traits/integral_constant.hpp>
@ -37,16 +38,16 @@ namespace sprout {
> >
: public std::iterator< : public std::iterator<
std::input_iterator_tag, std::input_iterator_tag,
typename Distribution::result_type, typename std::remove_reference<Distribution>::type::result_type,
std::ptrdiff_t, std::ptrdiff_t,
typename Distribution::result_type const*, typename std::remove_reference<Distribution>::type::result_type const*,
typename Distribution::result_type const& typename std::remove_reference<Distribution>::type::result_type const&
> >
{ {
public: public:
typedef Engine engine_type; typedef Engine engine_type;
typedef Distribution distribution_type; typedef Distribution distribution_type;
typedef typename distribution_type::result_type result_type; typedef typename std::remove_reference<distribution_type>::type::result_type result_type;
typedef sprout::random::variate_generator<engine_type, distribution_type> generator_type; typedef sprout::random::variate_generator<engine_type, distribution_type> generator_type;
private: private:
typedef std::iterator< typedef std::iterator<
@ -56,12 +57,23 @@ namespace sprout {
result_type const*, result_type const*,
result_type const& result_type const&
> base_type; > base_type;
typedef sprout::random::detail::ptr_helper<Engine> engine_helper_type;
typedef sprout::random::detail::ptr_helper<Distribution> distribution_helper_type;
public: public:
typedef typename base_type::iterator_category iterator_category; typedef typename base_type::iterator_category iterator_category;
typedef typename base_type::value_type value_type; typedef typename base_type::value_type value_type;
typedef typename base_type::difference_type difference_type; typedef typename base_type::difference_type difference_type;
typedef typename base_type::pointer pointer; typedef typename base_type::pointer pointer;
typedef typename base_type::reference reference; typedef typename base_type::reference reference;
typedef typename engine_helper_type::value_type engine_value_type;
typedef typename distribution_helper_type::value_type distribution_value_type;
typedef typename engine_helper_type::reference_type engine_reference_type;
typedef typename distribution_helper_type::reference_type distribution_reference_type;
typedef typename engine_helper_type::const_reference_type engine_const_reference_type;
typedef typename distribution_helper_type::const_reference_type distribution_const_reference_type;
typedef typename engine_helper_type::rvalue_type engine_param_type;
typedef typename distribution_helper_type::rvalue_type distribution_param_type;
typedef typename generator_type::random_result_type random_result_type;
private: private:
result_type result_; result_type result_;
generator_type generator_; generator_type generator_;
@ -71,13 +83,13 @@ namespace sprout {
{} {}
random_result(random_result const&) = default; random_result(random_result const&) = default;
SPROUT_CONSTEXPR random_result( SPROUT_CONSTEXPR random_result(
result_type result, result_type const& result,
engine_type const& engine, distribution_type const& distribution engine_param_type engine, distribution_param_type distribution
) )
: result_(result) : result_(result)
, generator_(engine, distribution) , generator_(engine, distribution)
{} {}
SPROUT_CONSTEXPR random_result operator()() const { SPROUT_CONSTEXPR random_result_type operator()() const {
return generator_(); return generator_();
} }
SPROUT_CXX14_CONSTEXPR result_type& generated_value() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR result_type& generated_value() SPROUT_NOEXCEPT {
@ -92,6 +104,9 @@ namespace sprout {
SPROUT_CONSTEXPR generator_type const& next_generator() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR generator_type const& next_generator() const SPROUT_NOEXCEPT {
return generator_; return generator_;
} }
SPROUT_CONSTEXPR random_result_type next_value() const SPROUT_NOEXCEPT {
return generator_();
}
SPROUT_CXX14_CONSTEXPR result_type& result() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR result_type& result() SPROUT_NOEXCEPT {
return result_; return result_;
} }
@ -104,16 +119,16 @@ namespace sprout {
SPROUT_CONSTEXPR generator_type const& next() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR generator_type const& next() const SPROUT_NOEXCEPT {
return generator_; return generator_;
} }
SPROUT_CXX14_CONSTEXPR engine_type& engine() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR engine_reference_type engine() SPROUT_NOEXCEPT {
return generator_.engine(); return generator_.engine();
} }
SPROUT_CONSTEXPR engine_type const& engine() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR engine_const_reference_type engine() const SPROUT_NOEXCEPT {
return generator_.engine(); return generator_.engine();
} }
SPROUT_CXX14_CONSTEXPR distribution_type& distribution() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR distribution_reference_type distribution() SPROUT_NOEXCEPT {
return generator_.distribution(); return generator_.distribution();
} }
SPROUT_CONSTEXPR distribution_type const& distribution() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR distribution_const_reference_type distribution() const SPROUT_NOEXCEPT {
return generator_.distribution(); return generator_.distribution();
} }
SPROUT_CXX14_CONSTEXPR operator result_type&() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR operator result_type&() SPROUT_NOEXCEPT {
@ -170,15 +185,15 @@ namespace sprout {
> >
: public std::iterator< : public std::iterator<
std::input_iterator_tag, std::input_iterator_tag,
typename Engine::result_type, typename std::remove_reference<Engine>::type::result_type,
std::ptrdiff_t, std::ptrdiff_t,
typename Engine::result_type const*, typename std::remove_reference<Engine>::type::result_type const*,
typename Engine::result_type const& typename std::remove_reference<Engine>::type::result_type const&
> >
{ {
public: public:
typedef Engine engine_type; typedef Engine engine_type;
typedef typename engine_type::result_type result_type; typedef typename std::remove_reference<Engine>::type::result_type result_type;
typedef engine_type generator_type; typedef engine_type generator_type;
private: private:
typedef std::iterator< typedef std::iterator<
@ -188,12 +203,18 @@ namespace sprout {
result_type const*, result_type const*,
result_type const& result_type const&
> base_type; > base_type;
typedef sprout::random::detail::ptr_helper<Engine> engine_helper_type;
public: public:
typedef typename base_type::iterator_category iterator_category; typedef typename base_type::iterator_category iterator_category;
typedef typename base_type::value_type value_type; typedef typename base_type::value_type value_type;
typedef typename base_type::difference_type difference_type; typedef typename base_type::difference_type difference_type;
typedef typename base_type::pointer pointer; typedef typename base_type::pointer pointer;
typedef typename base_type::reference reference; typedef typename base_type::reference reference;
typedef typename engine_helper_type::value_type engine_value_type;
typedef typename engine_helper_type::reference_type engine_reference_type;
typedef typename engine_helper_type::const_reference_type engine_const_reference_type;
typedef typename engine_helper_type::rvalue_type engine_param_type;
typedef random_result random_result_type;
private: private:
result_type result_; result_type result_;
generator_type generator_; generator_type generator_;
@ -202,10 +223,10 @@ namespace sprout {
: result_(), generator_() : result_(), generator_()
{} {}
random_result(random_result const&) = default; random_result(random_result const&) = default;
SPROUT_CONSTEXPR random_result(result_type result, engine_type const& engine) SPROUT_CONSTEXPR random_result(result_type result, engine_param_type engine)
: result_(result), generator_(engine) : result_(result), generator_(engine)
{} {}
SPROUT_CONSTEXPR random_result operator()() const { SPROUT_CONSTEXPR random_result_type operator()() const {
return generator_(); return generator_();
} }
SPROUT_CXX14_CONSTEXPR result_type& generated_value() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR result_type& generated_value() SPROUT_NOEXCEPT {
@ -220,6 +241,9 @@ namespace sprout {
SPROUT_CONSTEXPR generator_type const& next_generator() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR generator_type const& next_generator() const SPROUT_NOEXCEPT {
return generator_; return generator_;
} }
SPROUT_CONSTEXPR random_result_type next_value() const SPROUT_NOEXCEPT {
return generator_();
}
SPROUT_CXX14_CONSTEXPR result_type& result() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR result_type& result() SPROUT_NOEXCEPT {
return result_; return result_;
} }
@ -232,10 +256,10 @@ namespace sprout {
SPROUT_CONSTEXPR generator_type const& next() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR generator_type const& next() const SPROUT_NOEXCEPT {
return generator_; return generator_;
} }
SPROUT_CXX14_CONSTEXPR engine_type& engine() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR engine_reference_type engine() SPROUT_NOEXCEPT {
return generator_; return generator_;
} }
SPROUT_CONSTEXPR engine_type const& engine() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR engine_const_reference_type engine() const SPROUT_NOEXCEPT {
return generator_; return generator_;
} }
SPROUT_CXX14_CONSTEXPR operator result_type&() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR operator result_type&() SPROUT_NOEXCEPT {

View file

@ -14,6 +14,7 @@
#include <sprout/random/random_result_fwd.hpp> #include <sprout/random/random_result_fwd.hpp>
#include <sprout/type_traits/lvalue_reference.hpp> #include <sprout/type_traits/lvalue_reference.hpp>
#include <sprout/utility/lvalue_forward.hpp> #include <sprout/utility/lvalue_forward.hpp>
#include <sprout/utility/as_const.hpp>
#include <sprout/utility/swap.hpp> #include <sprout/utility/swap.hpp>
namespace sprout { namespace sprout {
@ -41,9 +42,16 @@ namespace sprout {
typedef typename distribution_value_type::result_type result_type; typedef typename distribution_value_type::result_type result_type;
typedef typename std::conditional< typedef typename std::conditional<
std::is_reference<engine_type>::value && !std::is_const<typename std::remove_reference<engine_type>::type>::value, std::is_reference<engine_type>::value && !std::is_const<typename std::remove_reference<engine_type>::type>::value,
result_type, sprout::random::random_result<engine_type, distribution_type>,
sprout::random::random_result<engine_value_type, distribution_value_type> sprout::random::random_result<engine_value_type, distribution_value_type>
>::type random_result_type; >::type random_result_type;
private:
static SPROUT_CONSTEXPR random_result_type call(variate_generator const& g, sprout::true_type) {
return random_result_type(g.distribution_(g.engine_), g.distribution_, g.engine_);
}
static SPROUT_CONSTEXPR random_result_type call(variate_generator const& g, sprout::false_type) {
return g.distribution_(sprout::as_const(g.engine_));
}
private: private:
engine_type engine_; engine_type engine_;
distribution_type distribution_; distribution_type distribution_;
@ -60,16 +68,20 @@ namespace sprout {
: engine_(engine) : engine_(engine)
, distribution_(distribution) , distribution_(distribution)
{} {}
SPROUT_CONSTEXPR random_result_type const operator()() const { SPROUT_CONSTEXPR random_result_type operator()() const {
return distribution_(engine_); typedef sprout::bool_constant<std::is_reference<engine_type>::value && !std::is_const<typename std::remove_reference<engine_type>::type>::value> tag;
return call(*this, tag());
} }
engine_reference_type engine() SPROUT_NOEXCEPT { SPROUT_CONSTEXPR random_result_type next_value() const {
return (*this)();
}
SPROUT_CXX14_CONSTEXPR engine_reference_type engine() SPROUT_NOEXCEPT {
return engine_helper_type::ref(engine_); return engine_helper_type::ref(engine_);
} }
SPROUT_CONSTEXPR engine_const_reference_type engine() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR engine_const_reference_type engine() const SPROUT_NOEXCEPT {
return engine_helper_type::ref(engine_); return engine_helper_type::ref(engine_);
} }
distribution_reference_type distribution() SPROUT_NOEXCEPT { SPROUT_CXX14_CONSTEXPR distribution_reference_type distribution() SPROUT_NOEXCEPT {
return distribution_helper_type::ref(distribution_); return distribution_helper_type::ref(distribution_);
} }
SPROUT_CONSTEXPR distribution_const_reference_type distribution() const SPROUT_NOEXCEPT { SPROUT_CONSTEXPR distribution_const_reference_type distribution() const SPROUT_NOEXCEPT {

View file

@ -19,6 +19,6 @@
#include <sprout/rational/values.hpp> #include <sprout/rational/values.hpp>
#include <sprout/rational/conversion.hpp> #include <sprout/rational/conversion.hpp>
#include <sprout/rational/exceptions.hpp> #include <sprout/rational/exceptions.hpp>
#include <sprout/rational/udl.hpp> #include <sprout/rational/literals.hpp>
#endif // #ifndef SPROUT_RATIONAL_HPP #endif // #ifndef SPROUT_RATIONAL_HPP

View file

@ -5,16 +5,17 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_RATIONAL_UDL_HPP #ifndef SPROUT_RATIONAL_LITERALS_HPP
#define SPROUT_RATIONAL_UDL_HPP #define SPROUT_RATIONAL_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/rational/rational.hpp> #include <sprout/rational/rational.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
namespace sprout { namespace sprout {
namespace udl { namespace literals {
namespace rational { namespace rational {
// //
// _r // _r
@ -51,20 +52,20 @@ namespace sprout {
} }
} // namespace rational } // namespace rational
using sprout::udl::rational::operator"" _r; using sprout::literals::rational::operator"" _r;
using sprout::udl::rational::operator"" _rl; using sprout::literals::rational::operator"" _rl;
using sprout::udl::rational::operator"" _rL; using sprout::literals::rational::operator"" _rL;
using sprout::udl::rational::operator"" _rll; using sprout::literals::rational::operator"" _rll;
using sprout::udl::rational::operator"" _rLL; using sprout::literals::rational::operator"" _rLL;
} // namespace udl } // namespace literals
using sprout::udl::rational::operator"" _r; using sprout::literals::rational::operator"" _r;
using sprout::udl::rational::operator"" _rl; using sprout::literals::rational::operator"" _rl;
using sprout::udl::rational::operator"" _rL; using sprout::literals::rational::operator"" _rL;
using sprout::udl::rational::operator"" _rll; using sprout::literals::rational::operator"" _rll;
using sprout::udl::rational::operator"" _rLL; using sprout::literals::rational::operator"" _rLL;
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_RATIONAL_UDL_HPP #endif // #ifndef SPROUT_RATIONAL_LITERALS_HPP

View file

@ -16,7 +16,7 @@
#include <sprout/utility/string_view/conversion.hpp> #include <sprout/utility/string_view/conversion.hpp>
#include <sprout/utility/string_view/type_traits.hpp> #include <sprout/utility/string_view/type_traits.hpp>
#include <sprout/utility/string_view/alias.hpp> #include <sprout/utility/string_view/alias.hpp>
#include <sprout/utility/string_view/udl.hpp> #include <sprout/utility/string_view/literals.hpp>
#include <sprout/utility/string_view/string_ref.hpp> #include <sprout/utility/string_view/string_ref.hpp>
#endif // #ifndef SPROUT_UTILITY_STRING_VIEW_HPP #endif // #ifndef SPROUT_UTILITY_STRING_VIEW_HPP

View file

@ -5,18 +5,19 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_UTILITY_STRING_VIEW_UDL_HPP #ifndef SPROUT_UTILITY_STRING_VIEW_LITERALS_HPP
#define SPROUT_UTILITY_STRING_VIEW_UDL_HPP #define SPROUT_UTILITY_STRING_VIEW_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/string_view/string_view.hpp> #include <sprout/utility/string_view/string_view.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
#include <sprout/workaround/std/cstddef.hpp> #include <sprout/workaround/std/cstddef.hpp>
namespace sprout { namespace sprout {
namespace udl { namespace literals {
namespace strings { namespace strings {
// //
// _sv // _sv
@ -41,12 +42,12 @@ namespace sprout {
#endif #endif
} // namespace strings } // namespace strings
using sprout::udl::strings::operator"" _sv; using sprout::literals::strings::operator"" _sv;
} // namespace udl } // namespace literals
using sprout::udl::strings::operator"" _sv; using sprout::literals::strings::operator"" _sv;
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_UTILITY_STRING_VIEW_UDL_HPP #endif // #ifndef SPROUT_UTILITY_STRING_VIEW_LITERALS_HPP

View file

@ -12,6 +12,7 @@
#include <sprout/string/char_traits.hpp> #include <sprout/string/char_traits.hpp>
#include <sprout/utility/string_view/string_view.hpp> #include <sprout/utility/string_view/string_view.hpp>
#include <sprout/utility/string_view/type_traits.hpp> #include <sprout/utility/string_view/type_traits.hpp>
#include <sprout/detail/udl_namespace.hpp>
namespace sprout { namespace sprout {
// //
@ -159,7 +160,7 @@ namespace sprout {
#endif #endif
#endif // #if SPROUT_USE_VARIABLE_TEMPLATES #endif // #if SPROUT_USE_VARIABLE_TEMPLATES
namespace udl { namespace literals {
namespace strings { namespace strings {
// //
// _sr // _sr
@ -184,10 +185,10 @@ namespace sprout {
#endif #endif
} // namespace strings } // namespace strings
using sprout::udl::strings::operator"" _sr; using sprout::literals::strings::operator"" _sr;
} // namespace udl } // namespace literals
using sprout::udl::strings::operator"" _sr; using sprout::literals::strings::operator"" _sr;
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_UTILITY_STRING_VIEW_STRING_REF_HPP #endif // #ifndef SPROUT_UTILITY_STRING_VIEW_STRING_REF_HPP

View file

@ -15,6 +15,6 @@
#include <sprout/uuid/tuple.hpp> #include <sprout/uuid/tuple.hpp>
#include <sprout/uuid/generators.hpp> #include <sprout/uuid/generators.hpp>
#include <sprout/uuid/namespaces.hpp> #include <sprout/uuid/namespaces.hpp>
#include <sprout/uuid/udl.hpp> #include <sprout/uuid/literals.hpp>
#endif // #ifndef SPROUT_UUID_HPP #endif // #ifndef SPROUT_UUID_HPP

View file

@ -5,11 +5,12 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/ =============================================================================*/
#ifndef SPROUT_UUID_UDL_HPP #ifndef SPROUT_UUID_LITERALS_HPP
#define SPROUT_UUID_UDL_HPP #define SPROUT_UUID_LITERALS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/uuid/uuid.hpp> #include <sprout/uuid/uuid.hpp>
#include <sprout/detail/udl_namespace.hpp>
#if SPROUT_USE_USER_DEFINED_LITERALS #if SPROUT_USE_USER_DEFINED_LITERALS
@ -61,7 +62,7 @@ namespace sprout {
} // namespace detail } // namespace detail
} // namespace uuids } // namespace uuids
namespace udl { namespace literals {
namespace uuids { namespace uuids {
// //
// _uuid // _uuid
@ -130,16 +131,16 @@ namespace sprout {
#endif #endif
} // namespace uuids } // namespace uuids
using sprout::udl::uuids::operator"" _uuid; using sprout::literals::uuids::operator"" _uuid;
using sprout::udl::uuids::operator"" _uuid3; using sprout::literals::uuids::operator"" _uuid3;
using sprout::udl::uuids::operator"" _uuid5; using sprout::literals::uuids::operator"" _uuid5;
} // namespace udl } // namespace literals
using sprout::udl::uuids::operator"" _uuid; using sprout::literals::uuids::operator"" _uuid;
using sprout::udl::uuids::operator"" _uuid3; using sprout::literals::uuids::operator"" _uuid3;
using sprout::udl::uuids::operator"" _uuid5; using sprout::literals::uuids::operator"" _uuid5;
} // namespace sprout } // namespace sprout
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS #endif // #if SPROUT_USE_USER_DEFINED_LITERALS
#endif // #ifndef SPROUT_UUID_UDL_HPP #endif // #ifndef SPROUT_UUID_LITERALS_HPP

View file

@ -29,6 +29,7 @@
#include <sprout/compressed_pair.hpp> #include <sprout/compressed_pair.hpp>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/container.hpp> #include <sprout/container.hpp>
#include <sprout/cstddef.hpp>
#include <sprout/cstdint.hpp> #include <sprout/cstdint.hpp>
#include <sprout/cstdlib.hpp> #include <sprout/cstdlib.hpp>
#include <sprout/cstring.hpp> #include <sprout/cstring.hpp>