diff options
author | kan <kan@FreeBSD.org> | 2005-06-03 03:29:38 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2005-06-03 03:29:38 +0000 |
commit | 3b6c93380e20c56b8151f9c6fc3916670b987df5 (patch) | |
tree | c4e455c4fe8d2a3ed1d621536386e3e252ad36bc /contrib/libstdc++/include/std/std_memory.h | |
parent | 2156e40a831a8e0ab68e4bc091c2940bf46ca6df (diff) | |
download | FreeBSD-src-3b6c93380e20c56b8151f9c6fc3916670b987df5.zip FreeBSD-src-3b6c93380e20c56b8151f9c6fc3916670b987df5.tar.gz |
Gcc 3.4.4 C++ support bits.
Diffstat (limited to 'contrib/libstdc++/include/std/std_memory.h')
-rw-r--r-- | contrib/libstdc++/include/std/std_memory.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/libstdc++/include/std/std_memory.h b/contrib/libstdc++/include/std/std_memory.h index 4e6641e..1d278e6 100644 --- a/contrib/libstdc++/include/std/std_memory.h +++ b/contrib/libstdc++/include/std/std_memory.h @@ -58,6 +58,7 @@ #include <bits/stl_uninitialized.h> #include <bits/stl_raw_storage_iter.h> #include <debug/debug.h> +#include <limits> namespace std { @@ -73,8 +74,9 @@ namespace std pair<_Tp*, ptrdiff_t> __get_temporary_buffer(ptrdiff_t __len, _Tp*) { - if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp))) - __len = INT_MAX / sizeof(_Tp); + const ptrdiff_t __max = numeric_limits<ptrdiff_t>::max() / sizeof(_Tp); + if (__len > __max) + __len = __max; while (__len > 0) { @@ -105,7 +107,7 @@ namespace std * Provides the nothrow exception guarantee. */ template<typename _Tp> - inline pair<_Tp*,ptrdiff_t> + inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) { return std::__get_temporary_buffer(__len, static_cast<_Tp*>(0)); } |