C++ Logo

sg20

Advanced search

Re: [isocpp-ext] namespace composition

From: Kirk Shoop <kirk.shoop_at_[hidden]>
Date: Mon, 1 May 2023 06:38:47 -0700
I considered that any solution had to violate the spirit of the standard.

🤪 does this satisfy the letter of the standard?

https://wandbox.org/permlink/xVXro6iWYGorqRqI

#include <vector>
namespace PPP {
template <class t>
struct type {
  inline static
  constexpr bool value = true;
};
template<class t>
concept win = type<t>::value;
}
template<PPP::win t, PPP::win a>
class std::vector<t, a> {
  public:
    void found_our_own() {}
};

On Mon, May 1, 2023 at 3:43 AM Jens Maurer <jens.maurer_at_[hidden]> wrote:

>
> On 01/05/2023 08.37, Kirk Shoop via Ext wrote:
> > This seems to work.
> >
> > https://wandbox.org/permlink/AxbjJtysQDG1AuaS <
> https://wandbox.org/permlink/AxbjJtysQDG1AuaS>
> >
> > Excerpt:
> >
> > #include <vector>
> > template<class t>
> > concept win = true;
> > namespace std {
> > template<win t, win a>
> > class vector<t, a> {
> > public:
> > void found_our_own() {}
> > };
> > }
>
>
> [namespace.std] p2 says
>
> "Unless explicitly prohibited, 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 (b) the specialization meets the standard library requirements
> for the original template."
>
> I'm not seeing your specialization to depend on a program-defined type;
> a concept is not a type.
>
> Jens
>

Received on 2023-05-01 13:39:01