Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-07-06 13:05:20


From: Tobias Schwinger <tschwinger_at_[hidden]>
>
> Here we go again. The next update. Big thanks go to Rob Stewart and David Abrahams
> for their helping with this text.

You're welcome. I'm glad to help.

> There is a version of this passage with markup: http://tinyurl.com/bxvke
>
> Can we freeze this part?

I don't think it is finished yet, but it is a vast improvement
over the earlier versions.

> Tag Types
> ----------
>
> The Function Type library uses tag types to represent one more properties of a
> type, such as its variadicness or whether the function is decorated with a pointer.

   function type, such as whether it is variadic or is a pointer
   to a function.

I dislike "variadicness."

It just struck me that a type is never decorated with a pointer,
though it can be a pointer to another type. Hence, "is a pointer
to a function" rather than "decorated with a pointer."

> Tags that represent the values of a single property are called property tags.
> These tags can be used to determine whether one property of a type or another tag
> has a particular value.
>
> is_function< T, variadic >
> is_function< T, pointer >
>
> A compound property tag describes a combination of possible values of different
> properties. The tag class template can be used to create a specific compound
> property tag.
>
> tag<pointer,variadic> // describes a pointer to a variadic function
>
> When several tags for the same property appear in the argument list, only the last

I think this may have bounced around already, but "the argument
list" sounds too vague to me. It should be "tag's argument
list."

> one is used; others are ignored.

s/others/all others/

> tag<pointer,reference> // same as 'reference'

s/'reference'/tag<reference>/

> The following code creates the type int(*)(int...).
>
> function_type<mpl::vector<int,int>, tag<pointer,variadic> >::type
>
> All properties not described by the tag acquire a default. The next example

   All properties have a default tag. If you don't specify a tag
   for a property, that property's default tag is used instead.
   The following expression

> creates the type of an undecorated (variadic) function of the default calling

s/ (variadic)/, variadic/
s/of the default/with the default/

> convention: int(int...).
>
> function_type<mpl::vector<int,int>, variadic >::type

Do the defaults only apply to synthesis? You only show/describe
their use in that context.

I haven't looked at the text with markup, but the following text
seems disjoint from the foregoing:

> A compound property tag matches a type only when all of its component properties
> match:
>
> is_function< void(&)(...) , tag<reference,variadic> >::value // is true
> is_function< void(X::*)(...), tag<reference,variadic> >::value // is false

Since this example uses is_function as the earlier examples did,
perhaps you could move this part ahead of "The following code
creates the type int(*)(int...)" part.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk