From afd678501729db10bfa1b2f4e711f1f46f67cc0d Mon Sep 17 00:00:00 2001
From: John Maddock
@@ -84,7 +84,7 @@ given.
@@ -174,7 +174,7 @@ in the default template.
@@ -247,7 +247,7 @@ otherwise it will call the "slow but safe version".
@@ -280,7 +280,7 @@
Table 1.1. Time taken to copy 1000 elements using `copy<const T*, T*>` (times +
Table 1.1. Time taken to copy 1000 elements using `copy<const T*, T*>` (times in micro-seconds)
@@ -416,7 +416,7 @@ to hold non-reference types, references, and constant references:
Table 1.2. Required Constructor Argument Types
+Table 1.2. Required Constructor Argument Types
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
+ An improved std::min
function could be written like this:
+
template <class T, class U> +typename common_type<T, U>::type min(T t, T u) +{ + return t < u ? t : u; +} ++
+ And now expressions such as: +
+min(1, 2.0) ++
+ will actually compile and return the correct type! +
++ | + |