C++ Logo

STD-DISCUSSION

Advanced search

Subject: Is it allowed to add constrained declarations to namespace std?
From: Giuseppe D'Angelo (giuseppe.dangelo_at_[hidden])
Date: 2019-07-26 15:15:37


For instance, is it allowed to do:

> namespace std {
> template <typename T>
> requires Foo<T>
> struct hash { ~~~ };
> }

?

http://eel.is/c++draft/namespace.std#2 says that

> a program may add a template specialization for any standard library class template to namespace std provided that (a) the added declaration depends on at least one program-defined type and

 From a certain reading, such a constrained class template is a
specialization: http://eel.is/c++draft/temp.class.spec#4
The question however is that the concept Foo is a "program-defined
type"? Or should the definition be extended with "program-defined type
or type concept"?

Thanks,

-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups