From a143a95f878d20e45b9d4bb3a2cbb181996fa200 Mon Sep 17 00:00:00 2001 From: Eyas Date: Fri, 12 Feb 2016 18:53:00 -0500 Subject: [PATCH] Address MSVC C4127 warning due to constant conditional expression when throwing a "count not find key" exception --- include/boost/ptr_container/ptr_map_adapter.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/boost/ptr_container/ptr_map_adapter.hpp b/include/boost/ptr_container/ptr_map_adapter.hpp index 5ffc0f47..d12a26b1 100644 --- a/include/boost/ptr_container/ptr_map_adapter.hpp +++ b/include/boost/ptr_container/ptr_map_adapter.hpp @@ -170,12 +170,10 @@ namespace ptr_container_detail const_mapped_reference lookup( const key_type& key ) const { const_iterator i = this->find( key ); - if( i != this->end() ) - return *i->second; - else - BOOST_PTR_CONTAINER_THROW_EXCEPTION( true, bad_ptr_container_operation, - "'ptr_map/multimap::at()' could" - " not find key" ); + BOOST_PTR_CONTAINER_THROW_EXCEPTION( i == this->end(), bad_ptr_container_operation, + "'ptr_map/multimap::at()' could" + " not find key" ); + return *i->second; } struct eraser // scope guard