Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment for replacing bdlb::NullableValue with std::pmr::optional #252

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,200 changes: 1,197 additions & 3 deletions groups/bdl/bdlb/bdlb_nullablevalue.h

Large diffs are not rendered by default.

40 changes: 36 additions & 4 deletions groups/bdl/bdlb/bdlb_nullablevalue.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@
using namespace BloombergLP;
using namespace bsl;

namespace std
{
/* template <typename _Alloc>
struct uses_allocator<bsl::string, _Alloc> : true_type {};
template <typename TYPE, typename _Alloc>
struct uses_allocator<bslalg::ConstructorProxy<bdlb::NullableValue<TYPE>>, _Alloc> : true_type {};
template <typename _Alloc>
struct uses_allocator<bsltf::AllocTestType, _Alloc> : true_type {};
template <typename _Alloc>
struct uses_allocator<bsltf::MovableAllocTestType, _Alloc> : true_type {};
template <typename _Alloc>
struct uses_allocator<bsltf::MoveOnlyAllocTestType, _Alloc> : true_type {};
template <typename _Alloc>
struct uses_allocator<bsltf::AllocBitwiseMoveableTestType, _Alloc> : true_type {};
*/}

// ============================================================================
// TEST PLAN
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1312,6 +1328,15 @@ struct UsesBslmaAllocator<NonAssignableAllocTestType> : bsl::true_type {
} // close namespace bslma
} // close enterprise namespace

namespace std
{
template <typename _Alloc>
struct uses_allocator<NonAssignableAllocTestType, _Alloc> : true_type {};
;
template <class TYPE, class _Alloc>
struct uses_allocator<TmvipAa<TYPE>, _Alloc> : true_type {};
}


// ======================================
// class ConvertibleFromAllocatorTestType
Expand Down Expand Up @@ -1498,6 +1523,13 @@ struct UsesBslmaAllocator<ConvertibleFromAllocatorTestType> : bsl::true_type {
} // close namespace bslma
} // close enterprise namespace

namespace std
{
template <typename _Alloc>
struct uses_allocator<ConvertibleFromAllocatorTestType, _Alloc> : true_type {};
;
}

// ============================================================================
// GLOBAL TYPEDEFS/CONSTANTS FOR TESTING
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1889,8 +1921,8 @@ void TestDriver<TEST_TYPE>::testCase24_withoutAllocator()
};
const int NUM_SPECS = sizeof SPECS / sizeof *SPECS;

Obj& (Obj::*operatorMAg) (bslmf::MovableRef<TEST_TYPE>) = &Obj::operator=;
(void) operatorMAg; // quash potential compiler warning
//Obj& (Obj::*operatorMAg) (bslmf::MovableRef<TEST_TYPE>) = &Obj::operator=;
//(void) operatorMAg; // quash potential compiler warning

if (verbose) printf("\nTesting move assignment (no allocator).\n");
{
Expand Down Expand Up @@ -3365,7 +3397,7 @@ void TestDriver<TEST_TYPE>::testCase21_withAllocator()
ASSERTV(SPEC, CONFIG, X == W);

// Verify subsequent manipulation of new object 'X'.
primaryManipulator(&mX, 'Z');
primaryManipulator(&mX, 'Z');
ASSERTV(SPEC, X != W);
ASSERTV(SPEC, X == Z);

Expand Down Expand Up @@ -7203,7 +7235,7 @@ int main(int argc, char *argv[])
{
Obj mX(&oa); const Obj& X = mX;
if (veryVeryVerbose) { T_ T_ P(X) }
ASSERT(X.isNull());
ASSERT(!mX.has_value());
ASSERT(0 == da.numBlocksTotal());
ASSERT(0 == oa.numBlocksTotal());
}
Expand Down
Loading