[ConceptGCC] |
ConceptGCC :Trying to compile std::plus |
From: Walter E Brown (wb_at_[hidden])
Date: 2008-10-06 15:38:31
The enclosed file represents my attempt to compile the constrained
version of std::plus<> using conceptg++ (GCC) 4.3.0 20070330
(experimental) (Indiana University ConceptGCC Alpha 7).
There are two issues:
1) When the struct attempts to inherit from std::binary_function<>, the
compiler seg-faults.
2) When I comment out the above inheritance, the compiler complains that
"constructor 'T'::T'(const T&)' is inaccessible"; although I can make
that go away by replacing the ReferentType constraint by a Regular
constraint, that's different from the spec in the CD.
Unrelated to the above, please note that:
3) The FloatingPointType concept seems to be missing from Alpha 7.
Thoughts, please? Best,
-- WEB
// ======================================================================
//
//
// ======================================================================
#include <concepts>
#include <functional>
namespace math
{
template< std::ReferentType T >
struct plus
//: public std::binary_function<T,T,T>
{
requires std::HasPlus<T,T>
&& std::Convertible<std::HasPlus<T,T>::result_type,T>
T
operator () ( T const & x, T const & y ) const
{ return x + y; }
};
} // namespace math