Path: csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: MiloRambaldi Newsgroups: comp.std.c++ Subject: Re: Random number engine adaptor requirements [rand.req.adapt] Date: Fri, 23 Mar 2012 17:10:46 -0700 (PDT) Organization: http://groups.google.com Lines: 46 Sender: std-cpp-request@vandevoorde.com Approved: stephen.clamage@oracle.com Message-ID: <15191105.1210.1332508808424.JavaMail.geo-discussion-forums@vbut24> References: <5521955.2673.1332349807497.JavaMail.geo-discussion-forums@vbue17> NNTP-Posting-Host: mR+8ZPMpoeZiWiYlaPzT87BmFS6Uvz8HXAzydM4Rw7U= Content-Type: text/plain; charset=ISO-8859-1 X-Trace: news.albasani.net GRR1LRqRW99GHtgm7BbsM32JbzsqOsIkDgALPzrT6AoyNqFPMz9WrCB643zGWdDHrPfDRup555LYx3jfng2dhA== X-Complaints-To: abuse@albasani.net NNTP-Posting-Date: Sat, 24 Mar 2012 00:10:47 +0000 (UTC) X-Mailer: Perl5 Mail::Internet v2.05 X-Submission-Address: std-cpp-submit@vandevoorde.com Cancel-Lock: sha1:MvOddW5MMAa9Jkxlf6XMbxLU9A4= X-Original-Date: Fri, 23 Mar 2012 06:20:08 -0700 (PDT) Xref: csiph.com comp.std.c++:459 Hi Daniel, Sorry but I was not asking about the right section. 26.5.1.5 is about types, whereas I was asking about engine adapter templates. My corrected question is essentially the same: In section 26.5.4 Random number engine adaptor class templates [rand.adapt], nothing is said about whether the random engine adapter template must accept, as a type template parameter, *all* random number engine types as in section 26.5.1.4. If a class template will only compile for a subset of all of the random number engine types, can it still satisfy the requirements of 26.5.4? On Thursday, March 22, 2012 2:23:45 PM UTC-4, Daniel Krügler wrote: > > In my opinion you are talking about two issues: > > 1) The most simple one is your last question: The answer is trivial: > Every requirement set can be refined to an arbitrary degree of > constraints. Given that fundamental property of refinements of concepts > there is no point that you can define your own random number engine > adaptor that accepts only a restricted set of engines (and the > restrictions can be defined by your-self). I think I've now clarified that (1) is not an issue? > > 2) Nonetheless I think that you are asking an interesting question in > regard to what the library specification describes. It is a fact that > all specialized library-defined engine adaptors do refer to evaluating > the expression e() given its engine(s) e in some way. This is to be > expected given the "interface" of general random number engines. From > the perspective of the standard, there does not exist any engine concept > which provides another way of reading the generated values of it's state > except from a function call expression without parameters. ... Yes, this is the whole point: I am assuming that an engine could provide some other way of reading generated values, in addition to those required by the standard, and still satisfy the requirements of 26.5.1.4 (yes?) I will describe some specifics on the engine adapter template that led to my question. I have my own concept of a "reversible random number engine", refining 26.5.1.4. In addition to the requirements of a random number engine, a reversible random number engine provides a method reverse() which generates random numbers in reverse order of operator()(). Then I have an adapter template called reverse_adapter: template class reverse_adapter { ... }; In general it will only compile if Engine is a reversible random number engine (i.e. has a reverse() method). (It should be obvious what the adapter does.) My question is whether reverse_adapter can satisfy the requirements of the standard, since it will not accept all Engine types? 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. -- [ 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 ]