C++ Logo

std-discussion

Advanced search

Is it allowed to add constrained declarations to namespace std?

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Fri, 26 Jul 2019 22:15:37 +0200
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

Received on 2019-07-26 15:17:39