Add geom::gradient default constructor

This commit is contained in:
Nikita Lisitsa 2023-02-25 12:42:15 +03:00
parent d90317576c
commit 84b804adf7

View file

@ -14,6 +14,8 @@ namespace psemek::geom
{
using result_type = R;
gradient() = default;
template <typename ... Args>
gradient(Args const & ... args)
{
@ -29,6 +31,8 @@ namespace psemek::geom
R operator()(T const & t) const
{
assert(!points_.empty());
auto it = std::upper_bound(points_.begin(), points_.end(), t, [](T const & t, auto const & p){ return t < p.first; });
if (it == points_.begin())
return points_.front().second;