This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: random numbers in bulk


Hi,

On 08/26/2012 07:19 PM, Ulrich Drepper wrote:
On Sun, Aug 26, 2012 at 10:27 AM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
Thus, all in all, for the time being I would go with __generate.
OK, here's a version of the patch with the patch for 54376 already assumed.

I changed to function name to __generate.  I feel much more
comfortable with using the leading underscores.

I changed _OutputIterator to _ForwardIterator.
If you have things like:

+      template<typename _UniformRandomNumberGenerator,
+	       typename _ForwardIterator>
+	void
+	__generate(_ForwardIterator __f, _ForwardIterator __t,
+		   _UniformRandomNumberGenerator& __urng)


then probably you want to swap the template parameters (or viceversa):


+      template<typename _ForwardIterator,
+	       typename _UniformRandomNumberGenerator>
+	void
+	__generate(_ForwardIterator __f, _ForwardIterator __t,
+		   _UniformRandomNumberGenerator& __urng)


Frankly, I'm finding the forwarding via __gnu_cxx::__normal_iterator pretty ugly. Can't we have instead an internal, private, __generate_impl(_ForwardIterator, _ForwardIterator, _UniformRandomNumberGenerator&, const param_type&) which is called by both the variant of __generate taking iterators and the variant taking pointers?


Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]