Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Concept maps and template specialization
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Scott Meyers  
View profile  
 More options Jun 9 2009, 8:05 am
Newsgroups: comp.lang.c++.moderated
From: Scott Meyers <use...@aristeia.com>
Date: Tue, 9 Jun 2009 06:05:55 CST
Local: Tues, Jun 9 2009 8:05 am
Subject: [C++0x] Concept maps and template specialization
Suppose I have a non-auto concept and a template that generates classes that
satisfy the concept:

   concept Mungible<typename T> {
     void T::Mung();
   }

   template<typename T>
   class Widget {
   public:
     void Mung();
   };

Am I permitted to have a templatized concept map, like this?

   template<typename T>                      // all Widget instantiations are
   concept_map Mungible<Widget<T>> {}        // Mungible

If not, how do I express that all Widget instantiations are a model of Mungible?

Suppose that not quite all of the classes generated by the template model the
concept.  This specialization, for example, does not:

   template<>
   class Widget<void> {
     void Smack();
   };

Will this compile, or is it contrary to the concept map above?

If the above compiles, what about the following?

   Widget<void> w;            // compiles?  We now have an instance of
                              // a class that doesn't satisfy Mungible

If that compiles, what about this, which invokes a template that requires the
concept:

   template<Mungible T>
   void f(T thingToMung);

   f(w);                      // compiles?  w isn't Mungible

Assuming that at least something above fails to compile, we can presumably fix
it via a suitable concept map:

   concept_map Mungible<Widget<void>> {
     void T::Mung() { T::Smack(); }
   }

Where would this have to be defined?  Presumably after the declaration of the
concept, but before or after the templatized concept map (or whatever mechanism
is used to assert that all instantiations of a template satisfy a concept)?

Thanks,

Scott

PS - My attempts to get conceptgcc up and running on my Windows XP machine have
failed, and the conceptgcc mailing list seem to be offline.  If you have
experience getting conceptgcc to work under WinXP and would be interested in
helping me coax life out of mine, please send me mail off-group:
smey...@aristeia.com.  Thanks.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gnepp...@web.de  
View profile  
 More options Jun 9 2009, 10:06 pm
Newsgroups: comp.lang.c++.moderated
From: gnepp...@web.de
Date: Tue, 9 Jun 2009 20:06:22 CST
Local: Tues, Jun 9 2009 10:06 pm
Subject: Re: Concept maps and template specialization
On 9 Jun., 12:05, Scott Meyers <use...@aristeia.com> wrote:

This I can answer positively:
14.5.6 of the C++0x draft mentions concept_map templates, and
14.9.2.1 gives a nice example for a concept_map partially specialized
for std::vector

> Suppose that not quite all of the classes generated by the template model the
> concept.  This specialization, for example, does not:

>    template<>
>    class Widget<void> {
>      void Smack();
>    };

> Will this compile, or is it contrary to the concept map above?

> If the above compiles, what about the following?

>    Widget<void> w;            // compiles?  We now have an instance of
>                               // a class that doesn't satisfy Mungible

I'd expect this to compile. A stand-alone template class (and all it's
specializations) must not, by all means, be dependent on any
concept_maps that define mappings to "external" concepts. This would
totally defeat de-coupling of components!

> If that compiles, what about this, which invokes a template that requires the
> concept:

>    template<Mungible T>
>    void f(T thingToMung);

>    f(w);                      // compiles?  w isn't Mungible

I'd expect this not to compile, since there is no concept_map that
fits the specialization Widget<void>.

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »