Adobe Source Libraries 2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
pin.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_PIN_HPP
9#define ADOBE_ALGORITHM_PIN_HPP
10
11#include <adobe/config.hpp>
12
13#if ADOBE_IS_DEPRECATED_ERROR(100039)
14#error "deprecated adobe/algorithm/pin.hpp use adobe/algorithm/clamp.hpp instead."
15#endif
16
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
46/**************************************************************************************************/
52template <typename T, typename R>
53inline const T& pin(const T& min, const T& x, const T& max, R r) {
54 return clamp(x, min, max, r);
55}
56
57/**************************************************************************************************/
63template <typename T>
64inline const T& pin(const T& min, const T& x, const T& max) {
65 return clamp(x, min, max);
66}
67
68
69/**************************************************************************************************/
75template <typename T, typename R>
76const T& pin_safe(const T& min, const T& x, const T& max, R r) {
77 return clamp_unordered(x, min, max, r);
78}
79
80/**************************************************************************************************/
86template <typename T, typename R>
87const T& pin_safe(const T& min, const T& x, const T& max) {
88 return clamp_unordered(x, min, max);
89}
90
91/**************************************************************************************************/
92
93} // namespace adobe
94
95/**************************************************************************************************/
96
97#endif
98
99/**************************************************************************************************/
const T & clamp(const T &x, const T &min, const T &max, R r)
clamp implementation
Definition clamp.hpp:46
const T & clamp_unordered(const T &x, const T &min, const T &max, R r)
clamp_unordered implementation
Definition clamp.hpp:89
const T & max(const T &a, const T &b, R r)
minmax implementation
Definition minmax.hpp:113
const T & min(const T &a, const T &b, R r)
minmax implementation
Definition minmax.hpp:69
const T & pin_safe(const T &min, const T &x, const T &max, R r)
pin_safe implementation
Definition pin.hpp:76
const T & pin(const T &min, const T &x, const T &max, R r)
pin implementation
Definition pin.hpp:53