diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/database.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 7 | ||||
-rw-r--r-- | src/mongo/stdx/functional.h | 40 | ||||
-rw-r--r-- | src/mongo/unittest/unittest.h | 13 |
4 files changed, 21 insertions, 53 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp index 815b543914c..4905b34d0c2 100644 --- a/src/mongo/db/catalog/database.cpp +++ b/src/mongo/db/catalog/database.cpp @@ -610,14 +610,20 @@ Status userCreateNS(OperationContext* txn, if (!status.isOK()) return status; - status = validateStorageOptions(collectionOptions.storageEngine, - &StorageEngine::Factory::validateCollectionStorageOptions); + status = + validateStorageOptions(collectionOptions.storageEngine, + stdx::bind(&StorageEngine::Factory::validateCollectionStorageOptions, + stdx::placeholders::_1, + stdx::placeholders::_2)); if (!status.isOK()) return status; if (auto indexOptions = collectionOptions.indexOptionDefaults["storageEngine"]) { - status = validateStorageOptions(indexOptions.Obj(), - &StorageEngine::Factory::validateIndexStorageOptions); + status = + validateStorageOptions(indexOptions.Obj(), + stdx::bind(&StorageEngine::Factory::validateIndexStorageOptions, + stdx::placeholders::_1, + stdx::placeholders::_2)); if (!status.isOK()) { return status; } diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index 9c15268a49c..09ac1c7f185 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -621,8 +621,11 @@ Status IndexCatalog::_isSpecOk(const BSONObj& spec) const { "Empty \"storageEngine\" options are invalid. " "Please remove the field or include valid options."); } - Status storageEngineStatus = validateStorageOptions( - storageEngineOptions, &StorageEngine::Factory::validateIndexStorageOptions); + Status storageEngineStatus = + validateStorageOptions(storageEngineOptions, + stdx::bind(&StorageEngine::Factory::validateIndexStorageOptions, + stdx::placeholders::_1, + stdx::placeholders::_2)); if (!storageEngineStatus.isOK()) { return storageEngineStatus; } diff --git a/src/mongo/stdx/functional.h b/src/mongo/stdx/functional.h index b0c6b922f99..0921cd22c94 100644 --- a/src/mongo/stdx/functional.h +++ b/src/mongo/stdx/functional.h @@ -28,15 +28,6 @@ #pragma once -// As of VS2013, the Windows STL still doesn't have an adequate implementation -// of std::function. -// -// See https://connect.microsoft.com/VisualStudio/feedback/details/768899/ -// std-function-not-compiling-in-vs2012 -// -// The bug is fixed in VS2015. -#if !defined(_MSC_VER) || (_MSC_VER > 1800) - #include <functional> namespace mongo { @@ -50,34 +41,3 @@ namespace placeholders = ::std::placeholders; // NOLINT } // namespace stdx } // namespace mongo - -#else - -#include <boost/bind.hpp> -#include <boost/function.hpp> -#include <boost/ref.hpp> - -namespace mongo { -namespace stdx { - -using boost::bind; // NOLINT -using boost::cref; // NOLINT -using boost::function; // NOLINT -using boost::ref; // NOLINT - -namespace placeholders { -static boost::arg<1> _1; -static boost::arg<2> _2; -static boost::arg<3> _3; -static boost::arg<4> _4; -static boost::arg<5> _5; -static boost::arg<6> _6; -static boost::arg<7> _7; -static boost::arg<8> _8; -static boost::arg<9> _9; -} // namespace placeholders - -} // namespace stdx -} // namespace mongo - -#endif diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index aea8faa8f8b..9c40621b3a4 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -126,13 +126,12 @@ * Behaves like ASSERT_THROWS, above, but also fails if calling what() on the thrown exception * does not return a string equal to EXPECTED_WHAT. */ -#define ASSERT_THROWS_WHAT(STATEMENT, EXCEPTION_TYPE, EXPECTED_WHAT) \ - ASSERT_THROWS_PRED(STATEMENT, \ - EXCEPTION_TYPE, \ - ::mongo::stdx::bind(std::equal_to<std::string>(), \ - (EXPECTED_WHAT), \ - ::mongo::stdx::bind(&EXCEPTION_TYPE::what, \ - ::mongo::stdx::placeholders::_1))) +#define ASSERT_THROWS_WHAT(STATEMENT, EXCEPTION_TYPE, EXPECTED_WHAT) \ + ASSERT_THROWS_PRED(STATEMENT, \ + EXCEPTION_TYPE, \ + ([&](const EXCEPTION_TYPE& ex) { \ + return ::mongo::StringData(ex.what()) == ::mongo::StringData(EXPECTED_WHAT); \ + })) /** * Behaves like ASSERT_THROWS, above, but also fails if calling getCode() on the thrown exception |