[Trilinos-Users] [EXTERNAL] Re: [12.2.1] compiler error with Teuchos on Clang
Hoemmen, Mark
mhoemme at sandia.gov
Fri Sep 4 13:20:19 EDT 2015
Hi Denis! Thanks for the suggestion! Please note the following:
http://en.cppreference.com/w/cpp/concept/Allocator
"Some requirements [of the Allocator concept] are optional: the template std::allocator_traits<http://en.cppreference.com/w/cpp/memory/allocator_traits> supplies the default implementations for all optional requirements, and all standard library containers and other allocator-aware classes access the allocator through std::allocator_traits, not directly."
Thus, implementations of the Allocator concept need not have a max_size() method. std::allocator_traits will fill in any optional methods. Does the class not compile for you?
mfh
On 9/3/15, 3:44 PM, "Denis Davydov" <davydden at gmail.com<mailto:davydden at gmail.com>> wrote:
Dear all,
it seems that Teuchos::Details::Allocator is missing std::allocator::max_size http://en.cppreference.com/w/cpp/memory/allocator/max_size
Do you think the patch below is the correct way to do it (I am just guessing here) ?
Regards,
Denis.
---
diff --git a/packages/teuchos/core/src/Teuchos_Details_Allocator.hpp b/packages/teuchos/core/src/Teuchos_Details_Allocator.hpp
index fc4c408..d44af4c 100644
--- a/packages/teuchos/core/src/Teuchos_Details_Allocator.hpp
+++ b/packages/teuchos/core/src/Teuchos_Details_Allocator.hpp
@@ -282,6 +282,11 @@ public:
/// the rebind struct is required.
template<class U>
struct rebind { typedef Allocator<U> other; };
+
+ size_type max_size() const
+ {
+ return std::numeric_limits<size_type>::max();
+ }
/// \brief Allocate an array of n instances of value_type.
///
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20150904/77546f64/attachment.html>
More information about the Trilinos-Users
mailing list