From 107446884c2e92b17f494ded21b315a052e51928 Mon Sep 17 00:00:00 2001 From: "jeanluc@chromium.org" Date: Sun, 30 Jan 2011 22:57:35 +0000 Subject: In Visual Studio 2010, pass a nullptr rather than NULL when building a std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair BUG=71138 TEST=Successful compile Review URL: http://codereview.chromium.org/6366023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73120 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/search_engines/template_url_model.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'chrome/browser/search_engines') diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index a1cfdac..9a7a193 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -246,6 +246,15 @@ void TemplateURLModel::FindMatchingKeywords( DCHECK(matches != NULL); DCHECK(matches->empty()); // The code for exact matches assumes this. + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + const TemplateURL* null_url = nullptr; +#else + const TemplateURL* null_url = NULL; +#endif + // Find matching keyword range. Searches the element map for keywords // beginning with |prefix| and stores the endpoints of the resulting set in // |match_range|. @@ -253,7 +262,8 @@ void TemplateURLModel::FindMatchingKeywords( KeywordToTemplateMap::const_iterator> match_range( std::equal_range( keyword_to_template_map_.begin(), keyword_to_template_map_.end(), - KeywordToTemplateMap::value_type(prefix, NULL), LessWithPrefix())); + KeywordToTemplateMap::value_type(prefix, null_url), + LessWithPrefix())); // Return vector of matching keywords. for (KeywordToTemplateMap::const_iterator i(match_range.first); -- cgit v1.1