Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #475

Re: Random number engine adaptor requirements [rand.req.adapt]

From Daniel Krügler <daniel.kruegler@googlemail.com>
Newsgroups comp.std.c++
Subject Re: Random number engine adaptor requirements [rand.req.adapt]
Date 2012-04-03 23:20 -0700
Organization A noiseless patient Spider
Message-ID <jle5hg$mo$1@dont-email.me> (permalink)
References <5521955.2673.1332349807497.JavaMail.geo-discussion-forums@vbue17> <jkdale$17a$1@dont-email.me> <15191105.1210.1332508808424.JavaMail.geo-discussion-forums@vbut24> <jkkd12$trv$1@dont-email.me> <12933145.26.1333324587141.JavaMail.geo-discussion-forums@vbw10>

Show all headers | View raw


On 2012-04-03 00:16, MiloRambaldi wrote:
>>
>>  >   My interpretation of the standard is yes,
>>  >   since there is no explicit requirement to accept all Engine types. However, I know others
>>  >   who have interpreted this section of the standard differently.
>>
>>  I agree that this is hard to conclude from the existing wording,


This was supposed to mean: The actual interpretation is hard to
conclude from the existing wording.

>>  because this textual definition is far less precise than a formal
>>  language. In concept language I would translate your type as
>>  satisfying a refined requirement set described by
>>
>>  concept ReversibleRandomNumberEngineAdaptor<typename A, typename B0,
>>  typename... Bi>   :
>>   RandomNumberEngineAdaptor<A, B0, Bi...>
>>  {
>>   requires ReversibleRandomNumberEngine<B0>   &&
>>  ReversibleRandomNumberEngine<Bi>...;
>>  }
>>
>>  Note that this definition has two sides:
>>
>>  a) It demonstrates that your reverse_adaptor can be considered as
>>  modelling some ReversibleRandomNumberEngineAdaptor requirement set,
>>  which indirectly means that it also models RandomNumberEngineAdaptor
>>  which means it models some specific random number engine adaptor that
>>  is described by [rand.req.adapt].
>
>
> According to my best understanding of what you have said:
>
> (1) reverse_adapter does *not* model RandomNumberEngineAdapter, and therefore does not satisfy section [rand.req.adapt] of the standard.


You got this conclusion wrong. What I was trying to say is that your
type (family) *does* satisfy the RandomNumberEngineAdapter
requirements (Note that it is less refined than
ReversibleRandomNumberEngineAdaptor) but it *also* imposes additional
requirements. In this regard it is not a *pure* refinement.

This is no fundamental defect, but it allows to argue that not all
Engines can be used as feasible arguments. My picture using
std::reverse_iterator (which also may not accept all iterators as
template arguments) was trying to demonstrate that your example is not
unique. You only have to keep in mind that reverse_adapter is some
special constrained RandomNumberEngineAdapter.

> (2) reverse_adapter does model the concept ReverseRandomNumberEngineAdapter, which indirectly "models" RandomNumberEngineAdpater by deriving from it


Yes, except that concepts don't derive from other concepts, they can
only refine other concepts. The syntax just looks like inheritance.

> and imposing further requirements on the Bi's.


Correct.

> (Though I am a bit confused by what you mean by "it models some specific random number engine adaptor that is described by [rand.req.adapt]".)


This should basically say the same as I described in my reply to (1)
above: "It models some *specific* [..]" was intended to emphasize the
fact that it imposes additional constraints upon the more general
requirement set from [rand.req.adapt].

> And most importantly:
>
> (3) Even though reverse_adapter does not satisfy the requirements of [rand.req.adapt],
> this is not a "defect" in the adapter, and just means that the additional requirement must be documented.


Exactly.

HTH & Greetings from Bremen,

Daniel Krügler


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Find similar


Thread

Random number engine adaptor requirements [rand.req.adapt] MiloRambaldi<james.hirschorn@gmail.com> - 2012-03-21 11:35 -0700
  Re: Random number engine adaptor requirements [rand.req.adapt] Daniel Krügler<daniel.kruegler@googlemail.com> - 2012-03-22 11:23 -0700
    Re: Random number engine adaptor requirements [rand.req.adapt] MiloRambaldi<james.hirschorn@gmail.com> - 2012-03-23 17:10 -0700
      Re: Random number engine adaptor requirements [rand.req.adapt] Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-03-24 19:26 -0700
        Re: Random number engine adaptor requirements [rand.req.adapt] MiloRambaldi<james.hirschorn@gmail.com> - 2012-04-02 15:16 -0700
          Re: Random number engine adaptor requirements [rand.req.adapt] Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-04-03 23:20 -0700

csiph-web