|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83156 - sandbox/pool2/boost/pool
From: svart.riddare_at_[hidden]
Date: 2013-02-25 15:33:47
Author: edupuis
Date: 2013-02-25 15:33:46 EST (Mon, 25 Feb 2013)
New Revision: 83156
URL: http://svn.boost.org/trac/boost/changeset/83156
Log:
Use type traits (std::has_trivial_destructor) to avoid performing useless operations in purge() function.
Text files modified:
sandbox/pool2/boost/pool/pool.hpp | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
Modified: sandbox/pool2/boost/pool/pool.hpp
==============================================================================
--- sandbox/pool2/boost/pool/pool.hpp (original)
+++ sandbox/pool2/boost/pool/pool.hpp 2013-02-25 15:33:46 EST (Mon, 25 Feb 2013)
@@ -13,10 +13,17 @@
#include <memory> // std::allocator
#include <vector> // std::vector
+#include <boost/tr1/type_traits.hpp>
+
#ifdef BOOST_POOL_VALGRIND
#include <valgrind/memcheck.h>
#endif
+#ifdef BOOST_MSVC
+ #pragma warning(push)
+ #pragma warning(disable: 4127) // Conditional expression is constant
+#endif
+
namespace boost
{
@@ -282,6 +289,11 @@
template<typename T, bool ThreadSafe, class Allocator>
void pool<T, ThreadSafe, Allocator>::purge()
{
+ /* -- Do not bother in case of POD buffers -- */
+
+ if (std::tr1::has_trivial_destructor<T>::value)
+ return;
+
/* -- If there is no outstanding buffers, there is nothing to do -- */
if (!_requested)
@@ -472,4 +484,8 @@
};
+#ifdef BOOST_MSVC
+ #pragma warning(pop)
+#endif
+
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk