.. index:: py::builtins::max .. _doxycast_pypp_namespacepy_1_1builtins_1aac1c7929d5b53bed904308873e7674ca: .. _py-builtins-max: *py::builtins::*\ max ===================== *Defined in* ```` .. code-block:: cpp template constexpr auto max(const it_type& iterable) -> decltype(*iterable.begin()); // 1 template < class type, class... arguments, class = std::enable_if_t< std::conjunction< std::is_same... >::value > > const type& max(const type& a, const arguments&... args); // 2 1. Returns the maximum value in an iterable. 2. Returns the maximum value in provided arguments. Template parameters ------------------- ``it_type``: Type of ``iterable``. ``type``: Type of arguments to compare. .. admonition:: Requirements of ``it_type`` ``it_type`` must be comparable. Parameters ---------- ``iterable``: An iterable object. ``a``: A comparable object. ``args``: Variable number comparable objects. Return value ------------ 1. The maximum value in the iterable. 2. The maximum value in provided arguments. Complexity ---------- 1. Linear in the size of ``iterable``. 2. Linear in the count of total arguments. Example ------- .. code-block:: cpp #include #include int main() { py::print(py::max(2, 3, 1, 4, 9)); } **Output**: .. code-block:: text 9