[ConceptGCC] |
ConceptGCC :Re: Trying to compile std::plus |
From: Sebastian Gesemann (s.gesemann_at_[hidden])
Date: 2008-10-07 12:04:56
On Mon, Oct 6, 2008 at 9:38 PM, Walter E Brown <wb_at_[hidden]> wrote:
> 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).
A constrained template should look more like this:
----------8<----------
#include <concepts>
#include <functional>
using namespace std;
template<typename T>
// requires ReferentType<T>
// && HasPlus<T,T>
// && Convertible<HasPlus<T,T>::result_type>,T>
struct plus : public std::binary_function<T,T,T>
{
T operator() (const T & x, const T & y) const
{ return x + y; }
};
----------8<----------
The requires clause goes right under the "template<>". Unfortunately I
can't get it to compile, either. I get the error:
test.cpp:9: Error: expected template-id before »T«
test.cpp:9: Error: expected unqualified-id before »>« token
If I omit line 9 ("// && Convertible<...>") I get a segfault, too.
(same ConceptGCC version)
Cheers,
SG