#ifndef ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_
#define ABSL_RANDOM_INTERNAL_UNIFORM_HELPER_H_
#include <cmath>
#include <limits>
#include <type_traits>
#include "absl/base/config.h"
#include "absl/meta/type_traits.h"
#include "absl/random/internal/traits.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
template <typename IntType>
class uniform_int_distribution;
template <typename RealType>
class uniform_real_distribution;
namespace random_internal {
template <typename T>
struct TagTypeCompare { … };
template <typename T>
constexpr bool operator==(TagTypeCompare<T>, TagTypeCompare<T>) { … }
template <typename T>
constexpr bool operator!=(TagTypeCompare<T>, TagTypeCompare<T>) { … }
}
struct IntervalClosedClosedTag
: public random_internal::TagTypeCompare<IntervalClosedClosedTag> { … };
struct IntervalClosedOpenTag
: public random_internal::TagTypeCompare<IntervalClosedOpenTag> { … };
struct IntervalOpenClosedTag
: public random_internal::TagTypeCompare<IntervalOpenClosedTag> { … };
struct IntervalOpenOpenTag
: public random_internal::TagTypeCompare<IntervalOpenOpenTag> { … };
namespace random_internal {
uniform_inferred_return_t;
template <typename IntType, typename Tag>
typename absl::enable_if_t<
absl::conjunction<
IsIntegral<IntType>,
absl::disjunction<std::is_same<Tag, IntervalOpenClosedTag>,
std::is_same<Tag, IntervalOpenOpenTag>>>::value,
IntType>
uniform_lower_bound(Tag, IntType a, IntType) { … }
template <typename FloatType, typename Tag>
typename absl::enable_if_t<
absl::conjunction<
std::is_floating_point<FloatType>,
absl::disjunction<std::is_same<Tag, IntervalOpenClosedTag>,
std::is_same<Tag, IntervalOpenOpenTag>>>::value,
FloatType>
uniform_lower_bound(Tag, FloatType a, FloatType b) { … }
template <typename NumType, typename Tag>
typename absl::enable_if_t<
absl::disjunction<std::is_same<Tag, IntervalClosedClosedTag>,
std::is_same<Tag, IntervalClosedOpenTag>>::value,
NumType>
uniform_lower_bound(Tag, NumType a, NumType) { … }
template <typename IntType, typename Tag>
typename absl::enable_if_t<
absl::conjunction<
IsIntegral<IntType>,
absl::disjunction<std::is_same<Tag, IntervalClosedOpenTag>,
std::is_same<Tag, IntervalOpenOpenTag>>>::value,
IntType>
uniform_upper_bound(Tag, IntType, IntType b) { … }
template <typename FloatType, typename Tag>
typename absl::enable_if_t<
absl::conjunction<
std::is_floating_point<FloatType>,
absl::disjunction<std::is_same<Tag, IntervalClosedOpenTag>,
std::is_same<Tag, IntervalOpenOpenTag>>>::value,
FloatType>
uniform_upper_bound(Tag, FloatType, FloatType b) { … }
template <typename IntType, typename Tag>
typename absl::enable_if_t<
absl::conjunction<
IsIntegral<IntType>,
absl::disjunction<std::is_same<Tag, IntervalClosedClosedTag>,
std::is_same<Tag, IntervalOpenClosedTag>>>::value,
IntType>
uniform_upper_bound(Tag, IntType, IntType b) { … }
template <typename FloatType, typename Tag>
typename absl::enable_if_t<
absl::conjunction<
std::is_floating_point<FloatType>,
absl::disjunction<std::is_same<Tag, IntervalClosedClosedTag>,
std::is_same<Tag, IntervalOpenClosedTag>>>::value,
FloatType>
uniform_upper_bound(Tag, FloatType, FloatType b) { … }
template <typename FloatType>
absl::enable_if_t<std::is_floating_point<FloatType>::value, bool>
is_uniform_range_valid(FloatType a, FloatType b) { … }
template <typename IntType>
absl::enable_if_t<IsIntegral<IntType>::value, bool>
is_uniform_range_valid(IntType a, IntType b) { … }
UniformDistribution;
template <typename NumType>
struct UniformDistributionWrapper : public UniformDistribution<NumType> { … };
}
ABSL_NAMESPACE_END
}
#endif