From 73ed9139f87274058773b4b4961a219a21883e1e Mon Sep 17 00:00:00 2001 From: "Patrick J. LoPresti" Date: Sun, 10 Jul 2016 14:55:13 -0700 Subject: [PATCH] Use copy_construct() instead of two calls to set() for rectangle assign(). This produces significantly better code when the rectangle representation is an immutable pair of points (lower left / upper right); e.g. SSE vectors. And there is no cost in speed for the normal case, since modern compilers are very good at copy elision. --- include/boost/polygon/rectangle_concept.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/boost/polygon/rectangle_concept.hpp b/include/boost/polygon/rectangle_concept.hpp index e8243190..99e1b3f6 100644 --- a/include/boost/polygon/rectangle_concept.hpp +++ b/include/boost/polygon/rectangle_concept.hpp @@ -190,8 +190,7 @@ namespace boost { namespace polygon{ typename is_rectangle_concept::type>::type>::type, rectangle_type_1>::type & assign(rectangle_type_1& lvalue, const rectangle_type_2& rvalue) { - set(lvalue, HORIZONTAL, get(rvalue, HORIZONTAL)); - set(lvalue, VERTICAL, get(rvalue, VERTICAL)); + lvalue = copy_construct(rvalue); return lvalue; }