-
Notifications
You must be signed in to change notification settings - Fork 155
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
Hotfix/allocator #100
Hotfix/allocator #100
Conversation
std::allocator<T>::construct/destroy were deprecated in C++17 and removed in C++20, in favor of std::allocator_traits<T>::construct/destroy. (https://en.cppreference.com/w/cpp/memory/allocator_traits/construct). They are gone in gcc10. This fix switches to the the latter for C++17 and greater.
std::iterator was deprecated in C++17 and removed in C++20. I replaced the inheritance with the 5 equivalent typedefs, even though they're not all used by ublas, for compatibility in case clients depend on them.
You should really have tests that verify the code can be used with a minimal allocator that only provides the members required by a C++11 allocator (i.e. For testing libstdc++ I use: template <class Tp>
struct SimpleAllocator
{
typedef Tp value_type;
SimpleAllocator() noexcept { }
template <class T>
SimpleAllocator(const SimpleAllocator<T>&) { }
Tp *allocate(std::size_t n)
{ return std::allocator<Tp>().allocate(n); }
void deallocate(Tp *p, std::size_t n)
{ std::allocator<Tp>().deallocate(p, n); }
};
template <class T, class U>
bool operator==(const SimpleAllocator<T>&, const SimpleAllocator<U>&)
{ return true; }
#if __cpp_impl_three_way_comparison < 201907L
template <class T, class U>
bool operator!=(const SimpleAllocator<T>&, const SimpleAllocator<U>&)
{ return false; }
#endif |
Yes, the code coverage for some Boost.uBlas data types are poor.
Thanks for providing the simple allocator. We are moving from one-/two- to multi-dimensional types (where one- or two dimensions will be special cases) making many of the current types obsoluete and therefore depcretated. Hence, our main focus will be on developing the multi-dimensional type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
This PR is not good. We don't want to use Edit: On top of that, you can't assume Just include |
Thanks @glenfe |
The deadline for putting things into the 1.74.0 release was .. yesterday. |
See glenfe@937da38 I'll PR from my repository after adding some tests for minimal allocators. |
@glenfe, I just wanted to update the PR using boost::core::allocator_accessor. :-) |
The |
Thanks @glenfe. To be consistent with the latter modifications, using |
PR #103 adjusts all places which use allocators, not just |
For the sake of consistency, using I found three places in ublas/include/boost/numeric/ublas/matrix.hpp Line 3463 in a31e5cf
ublas/include/boost/numeric/ublas/matrix.hpp Line 3938 in a31e5cf
ublas/include/boost/numeric/ublas/matrix.hpp Line 3463 in a31e5cf
|
If you look at #103 carefully, you'll see that it modifies the following files:
|
This is a hotfix for issue #96 which should be merged ASAP.