はじめに(Introduction)
N4910 Working Draft, Standard for Programming Language C++
n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。
<この項は書きかけです。順次追記します。>
背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。
この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。
cpprefjp - C++日本語リファレンス
コンパイラの実装状況
また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。
作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。
1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。
C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
C++N4606, 2016符号断片編纂一覧(example code compile list)
C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
C++N3242, 2011 sample code compile list on clang++ and g++
編纂器(Compiler)
clang++ --version
Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin
g++- --version
g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28.5 Random number generation [rand]C++N4910:2022 (668) p1278.cpp
算譜(source code)
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "28.5 Random number generation [rand]C++N4910:2022 (668) p1278.cpp";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91
#include "N4910.h"
using namespace std;
// 28.5.1 General [rand.general]
// In addition to a few utilities, four categories of entities are described: uniform random bit generators, random number engines, random number engine adaptors, and random number distributions. These categorizations are applicable to types that meet the corresponding requirements, to objects instantiated from such types, and to templates producing such types when instantiated.
// [Note 1: These entities are specified in such a way as to permit the binding of any uniform random bit generator object e as the argument to any random number distribution object d, thus producing a zero-argument function object such as given by bind(d,e). —end note]
// Each of the entities specified in 28.5 has an associated arithmetic type (6.8.2) identified as result_type. With T as the result_type thus associated with such an entity, that entity is characterized:
// — as boolean or equivalently as boolean-valued, if T is bool;
// — otherwise as integral or equivalently as integer-valued, if numeric_limits<T>::is_integer is true; — otherwise as floating-point or equivalently as real-valued.
// Unless otherwise specified, all descriptions of calculations in 28.5 use mathematical real numbers.
// 28.5.1
// If integer-valued, an entity may optionally be further characterized as signed or unsigned, according to numeric_limits<T>::is_signed.
// — the operator rshift denotes a bitwise right shift with zero-valued bits appearing in the high bits of the result, and
// — the operator lshiftw denotes a bitwise left shift with zero-valued bits appearing in the low bits of the result, and whose result is always taken modulo 2w.
// Throughout 28.5, the operators bitand, bitor, and xor denote the respective conventional bitwise operations. Further:
// 28.5.2 Header <random> synopsis [rand.synopsis]
#include <initializer_list>
namespace std {
// 28.5.3.3, uniform random bit generator requirements
template<class G>
concept uniform_random_bit_generator = see below;
// 28.5.4.2, class template linear_congruential_engine
template<class UIntType, UIntType a, UIntType c, UIntType m>
class linear_congruential_engine;
// 28.5.4.3, class template mersenne_twister_engine
template<class UIntType, size_t w, size_t n, size_t m, size_t r,
UIntType a, size_t u, UIntType d, size_t s,
UIntType b, size_t t,
UIntType c, size_t l, UIntType f>
class mersenne_twister_engine;
// 28.5.4.4, class template subtract_with_carry_engine
template<class UIntType, size_t w, size_t s, size_t r>
class subtract_with_carry_engine;
// 28.5.5.2, class template discard_block_engine
template<class Engine, size_t p, size_t r>
class discard_block_engine;
// 28.5.5.3, class template independent_bits_engine
template<class Engine, size_t w, class UIntType>
class independent_bits_engine;
// 28.5.5.4, class template shuffle_order_engine
template<class Engine, size_t k>
class shuffle_order_engine;
// 28.5.6, engines and engine adaptors with predefined parameters
using minstd_rand0 = see_below;
using minstd_rand = see_below;
using mt19937 = see_below;
using mt19937_64 = see_below;
using ranlux24_base = see_below;
using ranlux48_base = see_below;
using ranlux24 = see_below;
using ranlux48 = see_below;
using knuth_b = see_below;
// 28.5.7, class random_device
class random_device;
// 28.5.8.1, class seed_seq
class seed_seq;
// 28.5.8.2, function template generate_canonical
template<class RealType, size_t bits, class URBG>
RealType generate_canonical(URBG& g);
// 28.5.9.2.1, class template uniform_int_distribution
template<class IntType = int>
class uniform_int_distribution;
// 28.5.9.2.2, class template uniform_real_distribution
template<class RealType = double>
class uniform_real_distribution;
// 28.5.9.3.1, class bernoulli_distribution
class bernoulli_distribution;
// 28.5.9.3.2, class template binomial_distribution
template<class IntType = int>
class binomial_distribution;
// 28.5.9.3.3, class template geometric_distribution
template<class IntType = int>
class geometric_distribution;
// 28.5.9.3.4, class template negative_binomial_distribution
template<class IntType = int>
class negative_binomial_distribution;
// 28.5.9.4.1, class template poisson_distribution
template<class IntType = int>
class poisson_distribution;
// 28.5.9.4.2, class template exponential_distribution
template<class RealType = double>
class exponential_distribution;
// 28.5.9.4.3, class template gamma_distribution
template<class RealType = double>
class gamma_distribution;
// 28.5.9.4.4, class template weibull_distribution t
emplate<class RealType = double>
class weibull_distribution;
// 28.5.9.4.5, class template extreme_value_distribution
template<class RealType = double>
class extreme_value_distribution;
// 28.5.9.5.1, class template normal_distribution
template<class RealType = double>
class normal_distribution;
// 28.5.9.5.2, class template lognormal_distribution
template<class RealType = double>
class lognormal_distribution;
// 28.5.9.5.3, class template chi_squared_distribution
template<class RealType = double>
class chi_squared_distribution;
// 28.5.9.5.4, class template cauchy_distribution
template<class RealType = double> class cauchy_distribution;
// — that has a template type parameter named Sseq is undefined unless the corresponding template argument is cv-unqualified and meets the requirements of seed sequence (28.5.3.2).
// — that has a template type parameter named URBG is undefined unless the corresponding template argument is cv-unqualified and meets the requirements of uniform random bit generator (28.5.3.3).
// — that has a template type parameter named Engine is undefined unless the corresponding template argument is cv-unqualified and meets the requirements of random number engine (28.5.3.4).
// — that has a template type parameter named RealType is undefined unless the corresponding template argument is cv-unqualified and is one of float, double, or long double.
// — that has a template type parameter named IntType is undefined unless the corresponding template argument is cv-unqualified and is one of short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long.
// — that has a template type parameter named UIntType is undefined unless the corresponding template argument is cv-unqualified and is one of unsigned short, unsigned int, unsigned long, or unsigned long long.
// — T is the type named by S’s associated result_type;
// — qisavalueof Sandrisapossiblyconstvalueof S;
// — ib and ie are input iterators with an unsigned integer value_type of at least 32 bits;
// 28.5.9.5.5, class template fisher_f_distribution
template<class RealType = double>
class fisher_f_distribution;
// 28.5.9.5.6, class template student_t_distribution
template<class RealType = double>
class student_t_distribution;
// 28.5.9.6.1, class template discrete_distribution
template<class IntType = int>
class discrete_distribution;
// 28.5.9.6.2, class template piecewise_constant_distribution template<class RealType = double>
class piecewise_constant_distribution;
// 28.5.9.6.3, class template piecewise_linear_distribution
template<class RealType = double>
class piecewise_linear_distribution;
}
// 28.5.3 Requirements [rand.req]
// 28.5.3.1 General requirements [rand.req.genl]
// Throughout this subclause 28.5, the effect of instantiating a template:
// Throughout this subclause 28.5, phrases of the form “x is an iterator of a specific kind” shall be interpreted as equivalent to the more formal requirement that “x is a value of a type meeting the requirements of the specified iterator type”.
// Throughout this subclause 28.5, any constructor that can be called with a single argument and that meets a requirement specified in this subclause shall be declared explicit.
// 28.5.3.2 Seed sequence requirements [rand.req.seedseq]
// A seed sequence is an object that consumes a sequence of integer-valued data and produces a requested number of unsigned integer values i, 0 ≤ i < 232, based on the consumed data.
// [Note 1: Such an object provides a mechanism to avoid replication of streams of random variates. This can be useful, for example, in applications requiring large numbers of random number engines. —end note]
// A class S meets the requirements of a seed sequence if the expressions shown in Table 91 are valid and have the indicated semantics, and if S also meets all other requirements of this subclause 28.5.3.2. In that Table and throughout this subclause:
// - rb and re are mutable random access iterators with an unsigned integer value_type of at least 32 bits; — ob is an output iterator; and
// — il is a value of initializer_list<T>.
// Table 91: Seed sequence requirements [tab:rand.req.seedseq]
// — G::min() <= g(),
// — g() <= G::max(), and
// Expression Return type Pre/post-condition Complexity
// S::result_type T T is an unsigned integer compile-time type (6.8.2) of at least 32 bits.
// S() Creates a seed sequence with constant the same initial state as all other default-constructed seed sequences of type S.
// S(ib,ie) Creates a seed sequence having O(ie − ib) internal state that depends on some or all of the bits of the supplied sequence [ib, ie).
// S(il) Same as S(il.begin(), same as il.end()). S(il.begin(), il.end()) q.generate(rb,re) void
// Does nothing if rb == re. Otherwise, fills the supplied sequence [rb, re) with 32-bit quantities that depend on the sequence supplied to the constructor and possibly also depend on the history of generate’s previous invocations. O(re − rb) r.size() size_t The number of 32-bit units that constant would be copied by a call to r.param. r.param(ob) void
// Copies to the given destination a sequence of 32-bit units that can be provided to the constructor of a second object of type S, and that would reproduce in that second object a state indistinguishable from the state of the first object. O(r.size())
// 28.5.3.3 Uniform random bit generator requirements [rand.req.urng]
// A uniform random bit generator g of type G is a function object returning unsigned integer values such that each value in the range of possible results has (ideally) equal probability of being returned.
// [Note 1: The degree to which g’s results approximate the ideal is often determined statistically.
template<class G>
concept uniform_random_bit_generator =
invocable<G&> && unsigned_integral<invoke_result_t<G&>> &&
requires {
{ G::min() } -> same_as<invoke_result_t<G&>>;
{ G::max() } -> same_as<invoke_result_t<G&>>;
requires bool_constant<(G::min() < G::max())>::value;
};
// Let g be an object of type G. G models uniform_random_bit_generator only if
// — the size of E’s state in multiples of the size of result_type, given as an integral constant expression; — the transition algorithm TA by which e’s state ei is advanced to its successor state ei+1; and
// — the generation algorithm GA by which an engine’s state is mapped to a value of type result_type.
// — T is the type named by E’s associated result_type;
// — eisavalueof E,visanlvalueof E,xandyare(possiblyconst)valuesof E;
// — sisavalueof T;
// — q is an lvalue meeting the requirements of a seed sequence (28.5.3.2);
// — z is a value of type unsigned long long;
// — os is an lvalue of the type of some class template specialization basic_ostream<charT, traits>; and — is is an lvalue of the type of some class template specialization basic_istream<charT, traits>;
// — g() has amortized constant complexity.
// A class G meets the uniform random bit generator requirements if G models uniform_random_bit_generator, invoke_result_t<G&> is an unsigned integer type (6.8.2), and G provides a nested typedef-name result_type that denotes the same type as invoke_result_t<G&>.
// 28.5.3.4 Random number engine requirements [rand.req.eng]
// A random number engine (commonly shortened to engine) e of type E is a uniform random bit generator that additionally meets the requirements (e.g., for seeding and for input/output) specified in this subclause.
// At any given time, e has a state ei for some integer i ≥ 0. Upon construction, e has an initial state e0. An engine’s state may be established via a constructor, a seed function, assignment, or a suitable operator>>.
// E’s specification shall define:
// A class E that meets the requirements of a uniform random bit generator (28.5.3.3) also meets the requirements of a random number engine if the expressions shown in Table 92 are valid and have the indicated semantics, and if E also meets all other requirements of this subclause 28.5.3.4. In that Table and throughout this subclause: where charT and traits are constrained according to Clause 23 and Clause 31.
// Table 92: Random number engine requirements [tab:rand.req.eng]
// Expression Return type Pre/post-condition Complexity
// E() Creates an engine with the same O(size of state) initial state as all other default-constructed engines of type E.
// E(x) Creates an engine that compares O(size of state) equal to x.
// E(s) Creates an engine with initial O(size of state) state determined by s.
// E(q)231 Creates an engine with an initial state that depends on a sequence produced by one call to q.generate. same as complexity of q.generate called on a sequence whose length is size of state
// e.seed() void Postconditions: e == E(). same as E()
// e.seed(s) void Postconditions: e == E(s). same as E(s)
// e.seed(q) void Postconditions: e == E(q). same as E(q)
// e() T Advances e’s state ei to ei+1 per 28.5.3.3 = TA(ei) and returns GA(ei).
// Expression Return type Pre/post-condition Complexity e.discard(z)232 void Advances e’s state ei to ei+z by any means equivalent to z consecutive calls e(). no worse than the complexity of z consecutive calls e() x == y bool This operator is an equivalence relation. With Sx and Sy as the infinite sequences of values that would be generated by repeated future calls to x() and y(), respectively, returns true if Sx = Sy; else returns false. O(size of state) x != y bool !(x == y). O(size of state) os << x reference to the type of os With os.fmtflags set to ios_- base::dec|ios_base::left and the fill character set to the space character, writes to os the textual representation of x’s current state. In the output, adjacent numbers are separated by one or more space characters. Postconditions: The os.fmtflags and fill character are unchanged. O(size of state) is >> v reference to the type of is With is.fmtflags set to ios_base::dec, sets v’s state as determined by reading its textual representation from is. If bad input is encountered, ensures that v’s state is unchanged by the operation and calls is.setstate(ios_- base::failbit) (which may throw ios_base::failure (31.5.4.4)). If a textual representation written via os << x was subsequently read via is >> v, then x == v provided that there have been no intervening invocations of x or of v. Preconditions: is provides a textual representation that was previously written using an output stream whose imbued locale was the same as that of is, and whose type’s template specialization arguments charT and traits were respectively the same as those of is. Postconditions: The is.fmtflags are unchanged. O(size of state)
// E shall meet the Cpp17CopyConstructible (Table 31) and Cpp17CopyAssignable (Table 33) requirements. These operations shall each be of complexity no worse than O(size of state).
// — T is the type named by D’s associated result_type;
// — P is the type named by D’s associated param_type;
// — d is a value of D, and x and y are (possibly const) values of D;
// 28.5.3.5 Random number engine adaptor requirements [rand.req.adapt]
// A random number engine adaptor (commonly shortened to adaptor) a of type A is a random number engine that takes values produced by some other random number engine, and applies an algorithm to those values in order to deliver a sequence of values with different randomness properties. An engine b of type B adapted in this way is termed a base engine in this context. The expression a.base() shall be valid and shall return a const reference to a’s base engine.
// The requirements of a random number engine type shall be interpreted as follows with respect to a random number engine adaptor type.
A::A();
// Effects: The base engine is initialized as if by its default constructor. bool operator==(const A& a1, const A& a2);
// Returns: true if a1’s base engine is equal to a2’s base engine. Otherwise returns false. A::A(result_type s);
// Effects: The base engine is initialized with s. template<class Sseq> A::A(Sseq& q);
// Effects: The base engine is initialized with q. void seed();
// Effects: With b as the base engine, invokes b.seed(). void seed(result_type s);
// Effects: With b as the base engine, invokes b.seed(s).
template<class Sseq> void seed(Sseq& q);
// Effects: With b as the base engine, invokes b.seed(q).
// — The complexity of each function shall not exceed the complexity of the corresponding function applied to the base engine.
// — The state of A shall include the state of its base engine. The size of A’s state shall be no less than the size of the base engine.
// — Copying A’s state (e.g., during copy construction or copy assignment) shall include copying the state of the base engine of A.
// A shall also meet the following additional requirements:
// A random number distribution (commonly shortened to distribution) d of type D is a function object returning values that are distributed according to an associated mathematical probability density function p(z) or according to an associated discrete probability function P(zi). A distribution’s specification identifies its associated probability function p(z) or P(zi).
// An associated probability function is typically expressed using certain externally-supplied quantities known as the parameters of the distribution. Such distribution parameters are identified in this context by writing, for example, p(z | a, b) or P (zi | a, b), to name specific parameters, or by writing, for example, p(z | {p}) or P (zi | {p}), to denote a distribution’s parameters p taken as a whole.
// A class D meets the requirements of a random number distribution if the expressions shown in Table 93 are valid and have the indicated semantics, and if D and its associated types also meet all other requirements of this subclause 28.5.3.6. In that Table and throughout this subclause,
// — The textual representation of A shall include the textual representation of its base engine.
// 28.5.3.6 Random number distribution requirements [rand.req.dist]
// — glb and lub are values of T respectively corresponding to the greatest lower bound and the least upper bound on the values potentially returned by d’s operator(), as determined by the current values of d’s parameters;
// — p is a (possibly const) value of P;
// — g, g1, and g2 are lvalues of a type meeting the requirements of a uniform random bit generator (28.5.3.3);
// — os is an lvalue of the type of some class template specialization basic_ostream<charT, traits>; and
// — is is an lvalue of the type of some class template specialization basic_istream<charT, traits>;
// where charT and traits are constrained according to Clause 23 and Clause 31.
// Table 93: Random number distribution requirements [tab:rand.req.dist]
// Expression Return type Pre/post-condition Complexity
// D::result_type T T is an arithmetic type (6.8.2). compile-time
// D::param_type P compile-time
// D() Creates a distribution whose constant behavior is indistinguishable from that of any other newly default-constructed distribution of type D.
// D(p) Creates a distribution whose same as p’s behavior is indistinguishable construction from that of a distribution newly constructed directly from the values used to construct p.
// d.reset() void Subsequent uses of d do not constant depend on values produced by any engine prior to invoking reset.
// x.param() P Returns a value p such that no worse than D(p).param() == p. the complexity of D(p) d.param(p) void Postconditions: d.param() == no worse than p. the complexity of D(p) d(g) T
// With p = d.param(), the sequence of numbers returned by successive invocations with the same object g is randomly distributed according to the associated p(z | {p}) or P (zi | {p}) function. amortized constant number of invocations of g d(g,p) T The sequence of numbers returned by successive invocations with the same objects g and p is randomly distributed according to the associated p(z | {p}) or P (zi | {p}) function. amortized constant number of invocations of g x.min() T Returns glb. constant x.max() T Returns lub. constant
// Expression Return type Pre/post-condition Complexity x == y bool
// This operator is an equivalence relation. Returns true if x.param() == y.param() and S1 = S2, where S1 and S2 are the infinite sequences of values that would be generated, respectively, by repeated future calls to x(g1) and y(g2) whenever g1 == g2. Otherwise returns false. constant x != y bool !(x == y). sameasx == y. os << x
// reference to the type of os Writes to os a textual representation for the parameters and the additional internal data of x. Postconditions: The os.fmtflags and fill character are unchanged. is >> d reference to the type of is
// Restores from is the parameters and additional internal data of the lvalue d. If bad input is encountered, ensures that d is unchanged by the operation and calls is.setstate(ios_- base::failbit) (which may throw ios_base::failure (31.5.4.4)). Preconditions: is provides a textual representation that was previously written using an os whose imbued locale and whose type’s template specialization arguments charT and traits were the same as those of is. Postconditions: The is.fmtflags are unchanged.
// D shall meet the Cpp17CopyConstructible (Table 31) and Cpp17CopyAssignable (Table 33) requirements.
// The sequence of numbers produced by repeated invocations of d(g) shall be independent of any invocation of os << d or of any const member function of D between any of the invocations d(g).
// If a textual representation is written using os << x and that representation is restored into the same or a different object y of the same type using is >> y, repeated invocations of y(g) shall produce the same sequence of numbers as would repeated invocations of x(g).
// It is unspecified whether D::param_type is declared as a (nested) class or via a typedef. In this subclause 28.5, declarations of D::param_type are in the form of typedefs for convenience of exposition only.
// P shall meet the Cpp17CopyConstructible (Table 31), Cpp17CopyAssignable (Table 33), and Cpp17Equality- Comparable (Table 27) requirements.
// For each of the constructors of D taking arguments corresponding to parameters of the distribution, P shall have a corresponding constructor subject to the same requirements and taking arguments identical in number, type, and default values. Moreover, for each of the member functions of D that return values corresponding to parameters of the distribution, P shall have a corresponding member function with the identical name, type, and semantics.
// P shall have a declaration of the form using distribution_type = D;
// 28.5.4 Random number engine class templates [rand.eng]
// 28.5.4.1 General [rand.eng.general]
// Each type instantiated from a class template specified in 28.5.4 meets the requirements of a random number engine (28.5.3.4) type.
// Except where specified otherwise, the complexity of each function specified in 28.5.4 is constant.
// Except where specified otherwise, no function described in 28.5.4 throws an exception.
// Every function described in 28.5.4 that has a function parameter q of type Sseq& for a template type parameter named Sseq that is different from type seed_seq throws what and when the invocation of q.generate throws.
// 5 Descriptions are provided in 28.5.4 only for engine operations that are not described in 28.5.3.4 or for operations where there is additional semantic information. In particular, declarations for copy constructors, for copy assignment operators, for streaming operators, and for equality and inequality operators are not shown in the synopses.
// Each template specified in 28.5.4 requires one or more relationships, involving the value(s) of its non-type template parameter(s), to hold. A program instantiating any of these templates is ill-formed if any such required relationship fails to hold.
// For every random number engine and for every random number engine adaptor X defined in 28.5.4 and in 28.5.5:
// A linear_congruential_engine random number engine produces unsigned integer random numbers. The state xi of a linear_congruential_engine object x is of size 1 and consists of a single integer. The transition algorithm is a modular linear function of the form TA(xi) = (a · xi + c) mod m; the generation algorithm is GA(xi) = xi+1.
namespace std {
template<class UIntType, UIntType a, UIntType c, UIntType m>
class linear_congruential_engine {
public:
// types
using result_type = UIntType;
// engine characteristics
static constexpr result_type multiplier = a;
static constexpr result_type increment = c;
static constexpr result_type modulus = m;
static constexpr result_type min() {
return c == 0u ? 1u: 0u;
}
static constexpr result_type max() {
return m - 1u;
}
static constexpr result_type default_seed = 1u;
// constructors and seeding functions
linear_congruential_engine() : linear_congruential_engine(default_seed) {}
explicit linear_congruential_engine(result_type s);
template<class Sseq> explicit linear_congruential_engine(Sseq& q);
void seed(result_type s = default_seed);
// — if the constructor
template<class Sseq> explicit X(Sseq& q);
// is called with a type Sseq that does not qualify as a seed sequence, then this constructor shall not participate in overload resolution;
// — if the member function
template<class Sseq> void seed(Sseq& q);
// is called with a type Sseq that does not qualify as a seed sequence, then this function shall not participate in overload resolution. The extent to which an implementation determines that a type cannot be a seed sequence is unspecified, except that as a minimum a type shall not qualify as a seed sequence if it is implicitly convertible to X::result_type.
// 28.5.4.2 Class template linear_congruential_engine [rand.eng.lcong]
template<class Sseq> void seed(Sseq& q);
// equality operators
friend bool operator==(const linear_congruential_engine& x,
const linear_congruential_engine& y);
// generating functions
result_type operator()();
void discard(unsigned long long z);
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const linear_congruential_engine& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, linear_congruential_engine& x);
};
}
// If the template parameter m is 0, the modulus m used throughout this subclause 28.5.4.2 is numeric_- limits<result_type>::max() plus 1.
// [Note 1: m need not be representable as a value of type result_type.
// If the template parameter m is not 0, the following relations shall hold: a < m and c < m.
// The textual representation consists of the value of xi.
explicit linear_congruential_engine(result_type s);
// Effects: If c mod m is 0 and s mod m is 0, sets the engine’s state to 1, otherwise sets the engine’s state to s mod m.
// Effects: With k = log2 m and a an array (or equivalent) of length k + 3, invokes q.generate(a + 0, 32 a+k+3)andthencomputesS=k−1aj+3·232jmodm. Ifcmodmis0andSis0,setsthe j=0 engine’s state to 1, else sets the engine’s state to S.
// 28.5.4.3 Class template mersenne_twister_engine [rand.eng.mers]
// A mersenne_twister_engine random number engine233 produces unsigned integer random numbers in the closed interval [0, 2w − 1]. The state xi of a mersenne_twister_engine object x is of size n and consists of a sequence X of n values of the type delivered by x; all subscripts applied to X are to be taken modulo n.
// The transition algorithm employs a twisted generalized feedback shift register defined by shift values n and m, a twist value r, and a conditional xor-mask a. To improve the uniformity of the result, the bits of the raw shift register are additionally tempered (i.e., scrambled) according to a bit-scrambling matrix defined by values u, d, s, b, t, c, and l.
// The state transition is performed as follows:
// — Concatenate the upper w − r bits of Xi−n with the lower r bits of Xi+1−n to obtain an unsigned integer
template<class Sseq> explicit linear_congruential_engine(Sseq& q);
// value Y .
// —Withα=a·(Ybitand1),setXi toXi+m−nxor(Yrshift1)xorα.
// The sequence X is initialized with the help of an initialization multiplier f.
// The generation algorithm determines the unsigned integer values z1 , z2 , z3 , z4 as follows, then delivers z4 as its result:
// — Let z1 = Xi xor (Xi rshift u) bitand d. — Let z2 = z1 xor (z1 lshiftw s) bitand b. — Let z3 = z2 xor (z2 lshiftw t) bitand c.
explicit mersenne_twister_engine(result_type value);
// — Let z4 = z3 xor (z3 rshift l).
namespace std {
template<class UIntType, size_t w, size_t n, size_t m, size_t r,
UIntType a, size_t u, UIntType d, size_t s,
UIntType b, size_t t,
UIntType c, size_t l, UIntType f>
class mersenne_twister_engine {
public:
// types
using result_type = UIntType;
// engine characteristics
static constexpr size_t word_size = w;
static constexpr size_t state_size = n;
static constexpr size_t shift_size = m;
static constexpr size_t mask_bits = r;
static constexpr UIntType xor_mask = a;
static constexpr size_t tempering_u = u;
static constexpr UIntType tempering_d = d;
static constexpr size_t tempering_s = s;
static constexpr UIntType tempering_b = b;
static constexpr size_t tempering_t = t;
static constexpr UIntType tempering_c = c;
static constexpr size_t tempering_l = l;
static constexpr UIntType initialization_multiplier = f;
static constexpr result_type min() {
return 0;
}
static constexpr result_type max() {
return 2w − 1;
} static constexpr result_type default_seed = 5489u;
// constructors and seeding functions
mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
explicit mersenne_twister_engine(result_type value);
template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
void seed(result_type value = default_seed);
template<class Sseq> void seed(Sseq& q);
// equality operators
friend bool operator==(const mersenne_twister_engine& x, const mersenne_twister_engine& y);
// generating functions
result_type operator()();
void discard(unsigned long long z);
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const mersenne_twister_engine& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, mersenne_twister_engine& x);
};
}
// Thefollowingrelationsshallhold: 0 < m,m <= n,2u < w,r <= w,u <= w,s <= w,t <= w,l <= w,w <= numeric_limits<UIntType>::digits, a <= (1u<<w) - 1u, b <= (1u<<w) - 1u, c <= (1u<<w) - 1u, d
// Effects: SetsX−n tovaluemod2w. Then,iterativelyfori=1−n,...,−1,setsXi to f·Xi−1xorXi−1rshift(w−2)+imodnmod2w .
// Complexity: O(n).
template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
// Effects: With k = ⌈w/32⌉ and a an array (or equivalent) of length n · k, invokes q.generate(a + 0, a+n·k)andthen,iterativelyfori=−n,...,−1,setsXi tok−1ak(i+n)+j ·232jmod2w. Finally,
// A subtract_with_carry_engine random number engine produces unsigned integer random numbers.
// The state xi of a subtract_with_carry_engine object x is of size O(r), and consists of a sequence X of r integer values 0 ≤ Xi < m = 2w; all subscripts applied to X are to be taken modulo r. The state xi additionally consists of an integer c (known as the carry) whose value is either 0 or 1.
// The state transition is performed as follows: j=0 if the most significant w − r bits of X−n are zero, and if each of the other resulting Xi is 0, changes X−n to 2w−1.
// 28.5.4.4 Class template subtract_with_carry_engine [rand.eng.sub]
// — Let Y = Xi−s − Xi−r − c. theformmr−ms+1anda=b−(b−1)/m.
// The generation algorithm is given by GA(xi) = y, where y is the value produced as a result of advancing the engine’s state as described above.
namespace std {
template<class UIntType, size_t w, size_t s, size_t r>
class subtract_with_carry_engine {
public:
// types
using result_type = UIntType;
// engine characteristics
static constexpr size_t word_size = w;
static constexpr size_t short_lag = s;
static constexpr size_t long_lag = r;
static constexpr result_type min() {
return 0;
} static constexpr result_type max() {
return m−1;
} static constexpr result_type default_seed = 19780503u;
// constructors and seeding functions
subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
explicit subtract_with_carry_engine(result_type value);
template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
void seed(result_type value = default_seed);
template<class Sseq> void seed(Sseq& q);
// equality operators
friend bool operator==(const subtract_with_carry_engine& x,
const subtract_with_carry_engine& y);
// generating functions
result_type operator()();
void discard(unsigned long long z);
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const subtract_with_carry_engine& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, subtract_with_carry_engine& x);
};
}
// — SetXi toy=Y modm. Setcto1ifY <0,otherwisesetcto0.
// [Note 1: This algorithm corresponds to a modular linear function of the form TA(xi) = (a · xi) mod b, where b is of
// Effects: Sets the values of X−r, . . . , X−1, in that order, as specified below. If X−1 is then 0, sets c to 1; otherwise sets c to 0.
// To set the values Xk, first construct e, a linear_congruential_engine object, as if by the following definition:
linear_congruential_engine<result_type,
40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
// The following relations shall hold: 0u < s, s < r, 0 < w, and w <= numeric_limits<UIntType>::digits.
// The textual representation consists of the values of Xi−r , . . . , Xi−1 , in that order, followed by c.
explicit subtract_with_carry_engine(result_type value);
// Then, to set each Xk, obtain new values z0, . . . , zn−1 from n = ⌈w/32⌉ successive invocations of e. Set Xk to n−1 zj · 232j mod m. j=0
// Complexity: Exactly n · r invocations of e.
template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
// Effects: With k = ⌈w/32⌉ and a an array (or equivalent) of length r · k, invokes q.generate(a + 0, a+r·k)andthen,iterativelyfori=−r,...,−1,setsXi tok−1ak(i+r)+j ·232jmodm. IfX−1 is then 0, sets c to 1; otherwise sets c to 0.
// 28.5.5 Random number engine adaptor class templates [rand.adapt]
// 28.5.5.1 In general [rand.adapt.general]
// Each type instantiated from a class template specified in this subclause 28.5.5 meets the requirements of a random number engine adaptor (28.5.3.5) type.
// Except where specified otherwise, the complexity of each function specified in this subclause 28.5.5 is constant.
// Except where specified otherwise, no function described in this subclause 28.5.5 throws an exception.
// Every function described in this subclause 28.5.5 that has a function parameter q of type Sseq& for a template type parameter named Sseq that is different from type seed_seq throws what and when the invocation of q.generate throws.
// Descriptions are provided in this subclause 28.5.5 only for adaptor operations that are not described in subclause 28.5.3.5 or for operations where there is additional semantic information. In particular, declarations for copy constructors, for copy assignment operators, for streaming operators, and for equality and inequality operators are not shown in the synopses.
// Each template specified in this subclause 28.5.5 requires one or more relationships, involving the value(s) of its non-type template parameter(s), to hold. A program instantiating any of these templates is ill-formed if any such required relationship fails to hold.
// 28.5.5.2 Class template discard_block_engine [rand.adapt.disc]
// A discard_block_engine random number engine adaptor produces random numbers selected from those produced by some base engine e. The state xi of a discard_block_engine engine adaptor object x consists of the state ei of its base engine e and an additional integer n. The size of the state is the size of e’s state plus 1.
// The transition algorithm discards all but r > 0 values from each block of p ≥ r values delivered by e. The state transition is performed as follows: If n ≥ r, advance the state of e from ei to ei+p−r and set n to 0. In any case, then increment n and advance e’s then-current state ej to ej+1.
// The generation algorithm yields the value returned by the last invocation of e() while advancing e’s state as described above.
namespace std {
template<class Engine, size_t p, size_t r>
class discard_block_engine {
public:
// types
using result_type = typename Engine::result_type;
// engine characteristics
static constexpr size_t block_size = p;
static constexpr size_t used_block = r;
static constexpr result_type min() {
return Engine::min();
}
static constexpr result_type max() {
return Engine::max();
}
// constructors and seeding functions
discard_block_engine();
explicit discard_block_engine(const Engine& e);
explicit discard_block_engine(Engine&& e);
explicit discard_block_engine(result_type s);
template<class Sseq> explicit discard_block_engine(Sseq& q);
void seed();
void seed(result_type s);
template<class Sseq> void seed(Sseq& q);
// equality operators
friend bool operator==(const discard_block_engine& x, const discard_block_engine& y);
// generating functions
result_type operator()();
void discard(unsigned long long z);
// property functions
const Engine& base() const noexcept {
return e;
};
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const discard_block_engine& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, discard_block_engine& x);
private:
Engine e; // exposition only
size_t n; // exposition only
};
}
// The following relations shall hold: 0 < r and r <= p.
// The textual representation consists of the textual representation of e followed by the value of n.
// In addition to its behavior pursuant to subclause 28.5.3.5, each constructor that is not a copy constructor sets n to 0.
// 28.5.5.3 Class template independent_bits_engine [rand.adapt.ibits]
// An independent_bits_engine random number engine adaptor combines random numbers that are produced by some base engine e, so as to produce random numbers with a specified number of bits w. The state xi of an independent_bits_engine engine adaptor object x consists of the state ei of its base engine e; the size of the state is the size of e’s state.
// The transition and generation algorithms are described in terms of the following integral constants:
// — LetR=e.max() - e.min() + 1andm=⌊log2R⌋.
// — With n as determined below, let w0 = ⌊w/n⌋, n0 = n−wmodn, y0 = 2w0 ⌊R/2w0⌋, and y1 = 2w0+1 R/2w0+1.
// The transition algorithm is carried out by invoking e() as often as needed to obtain n0 values less than y0 + e.min() and n − n0 values less than y1 + e.min().
// — Let n = ⌈w/m⌉ if and only if the relation R−y0 ≤ ⌊y0/n⌋ holds as a result. Otherwise let n = 1+⌈w/m⌉. [Note1:Therelationw=n0w0+(n−n0)(w0+1)alwaysholds.
// The generation algorithm uses the values produced while advancing the state as described above to yield a quantity S obtained as if by the following algorithm:
S = 0;
for(k=0; k̸=n0; k+=1) {
do u = e() - e.min();
while (u ≥ y0);
S = 2w0 ·S+umod2w0;
}
for(k=n0; k̸=n; k+=1) {
do u = e() - e.min();
while (u ≥ y1);
S = 2w0+1 ·S+umod2w0+1;
}
template<class Engine, size_t w, class UIntType>
class independent_bits_engine {
public:
// types
using result_type = UIntType;
// engine characteristics
static constexpr result_type min() {
return 0;
} static constexpr result_type max() {
return 2w − 1;
}
// constructors and seeding functions
independent_bits_engine();
explicit independent_bits_engine(const Engine& e);
explicit independent_bits_engine(Engine&& e);
explicit independent_bits_engine(result_type s);
template<class Sseq> explicit independent_bits_engine(Sseq& q);
void seed();
void seed(result_type s);
template<class Sseq> void seed(Sseq& q);
// equality operators
friend bool operator==(const independent_bits_engine& x, const independent_bits_engine& y);
// generating functions
result_type operator()();
void discard(unsigned long long z);
// property functions
const Engine& base() const noexcept {
return e;
};
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const independent_bits_engine& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, independent_bits_engine& x);
private:
Engine e; // exposition only
};
// The following relations shall hold: 0 < w and w <= numeric_limits<result_type>::digits.
// The textual representation consists of the textual representation of e.
// 28.5.5.4 Class template shuffle_order_engine [rand.adapt.shuf]
// A shuffle_order_engine random number engine adaptor produces the same random numbers that are produced by some base engine e, but delivers them in a different sequence. The state xi of a shuffle_- order_engine engine adaptor object x consists of the state ei of its base engine e, an additional value Y of the type delivered by e, and an additional sequence V of k values also of the type delivered by e. The size of the state is the size of e’s state plus k + 1.
// — Calculate an integer j = k·(Y −emin) . emax −emin +1
// The transition algorithm permutes the values produced by e. The state transition is performed as follows:
// — SetY toVj andthensetVj toe().
// The generation algorithm yields the last value of Y produced while advancing e’s state as described above.
namespace std {
template<class Engine, size_t k>
class shuffle_order_engine {
public:
// types
using result_type = typename Engine::result_type;
// engine characteristics
static constexpr size_t table_size = k;
static constexpr result_type min() {
return Engine::min();
}
static constexpr result_type max() {
return Engine::max();
}
// constructors and seeding functions
shuffle_order_engine();
explicit shuffle_order_engine(const Engine& e);
explicit shuffle_order_engine(Engine&& e);
explicit shuffle_order_engine(result_type s);
template<class Sseq> explicit shuffle_order_engine(Sseq& q);
void seed();
void seed(result_type s);
template<class Sseq> void seed(Sseq& q);
// equality operators
friend bool operator==(const shuffle_order_engine& x, const shuffle_order_engine& y);
// generating functions
result_type operator()();
void discard(unsigned long long z);
// property functions
const Engine& base() const noexcept {
return e;
};
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const shuffle_order_engine& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, shuffle_order_engine& x);
private:
Engine e;
result_type V[k];
result_type Y;
};
}
// exposition only // exposition only // exposition only
// The following relation shall hold: 0 < k.
// The textual representation consists of the textual representation of e, followed by the k values of V , followed by the value of Y .
// In addition to its behavior pursuant to subclause 28.5.3.5, each constructor that is not a copy constructor initializes V[0], . . . , V[k-1] and Y , in that order, with values returned by successive invocations of e().
// 28.5.6 Engines and engine adaptors with predefined parameters [rand.predef]
using minstd_rand0 =
linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type minstd_- rand0 produces the value 1043618065.
// A random_device uniform random bit generator produces nondeterministic random numbers.
// If implementation limitations prevent generating nondeterministic random numbers, the implementation may employ a random number engine.
namespace std {
class random_device {
public:
using minstd_rand =
linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type minstd_- rand produces the value 399268537.
using mt19937 =
mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type mt19937 produces the value 4123659995.
using mt19937_64 =
mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type mt19937_- 64 produces the value 9981545732273789042.
using ranlux24_base =
subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type ran- lux24_base produces the value 7937952.
using ranlux48_base =
subtract_with_carry_engine<uint_fast64_t, 48, 5, 12>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type ran- lux48_base produces the value 61839128582725.
using ranlux24 = discard_block_engine<ranlux24_base, 223, 23>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type ranlux24 produces the value 9901578.
using ranlux48 = discard_block_engine<ranlux48_base, 389, 11>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type ranlux48 produces the value 249142670248501.
using knuth_b = shuffle_order_engine<minstd_rand0,256>;
// Required behavior: The 10000th consecutive invocation of a default-constructed object of type knuth_b produces the value 1112339016.
using default_random_engine = implementation-defined;
// Remarks: The choice of engine type named by this typedef is implementation-defined.
// [Note 1: The implementation can select this type on the basis of performance, size, quality, or any combination of such factors, so as to provide at least acceptable engine behavior for relatively casual, inexpert, and/or lightweight use. Because different implementations can select different underlying engine types, code that uses this typedef need not generate identical sequences across implementations.
// 28.5.7 Class random_device [rand.device]
// Throws: A value of an implementation-defined type derived from exception if the random_device cannot be initialized.
// Remarks: The semantics of the token parameter and the token value used by the default constructor are implementation-defined.234
// types
using result_type = unsigned int;
// generator characteristics
static constexpr result_type min() {
return numeric_limits<result_type>::min();
}
static constexpr result_type max() {
return numeric_limits<result_type>::max();
}
// constructors
random_device() : random_device(implementation-defined) {} explicit random_device(const string& token);
// generating functions
result_type operator()();
// property functions
double entropy() const noexcept;
// no copy functions
random_device(const random_device&) = delete;
void operator=(const random_device&) = delete;
};
}
explicit random_device(const string& token);
double entropy() const noexcept;
// Returns: If the implementation employs a random number engine, returns 0.0. Otherwise, returns an entropy estimate235 for the random numbers returned by operator(), in the range min() to log2(max() + 1).
result_type operator()();
// Returns: A nondeterministic random value, uniformly distributed between min() and max() (inclusive). It is implementation-defined how these values are generated.
// Throws: A value of an implementation-defined type derived from exception if a random number cannot be obtained.
// 28.5.8 Utilities [rand.util]
// 28.5.8.1 Class seed_seq [rand.util.seedseq]
namespace std {
class seed_seq {
public:
// types
using result_type = uint_least32_t;
// constructors
seed_seq() noexcept;
template<class T>
seed_seq(initializer_list<T> il);
template<class InputIterator>
seed_seq(InputIterator begin, InputIterator end);
// Postconditions: v.empty() is true. template<class T>
// generating functions
template<class RandomAccessIterator>
void generate(RandomAccessIterator begin, RandomAccessIterator end);
// property functions
size_t size() const noexcept;
template<class OutputIterator>
void param(OutputIterator dest) const;
// no copy functions
seed_seq(const seed_seq&) = delete;
void operator=(const seed_seq&) = delete;
private:
vector<result_type> v;
};
}
seed_seq() noexcept;
// exposition only
seed_seq(initializer_list<T> il);
// Constraints: T is an integer type.
// Effects: Same as seed_seq(il.begin(), il.end()).
template<class InputIterator>
seed_seq(InputIterator begin, InputIterator end);
// Mandates: iterator_traits<InputIterator>::value_type is an integer type. // Preconditions: InputIterator meets the Cpp17InputIterator requirements (25.3.5.3). Effects: Initializes v by the following algorithm:
for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
template<class RandomAccessIterator>
void generate(RandomAccessIterator begin, RandomAccessIterator end);
// Mandates: iterator_traits<RandomAccessIterator>::value_type is an unsigned integer type ca- pable of accommodating 32-bit quantities.
// Preconditions: RandomAccessIterator meets the Cpp17RandomAccessIterator requirements (25.3.5.7) and the requirements of a mutable iterator.
// Effects: Does nothing if begin == end. Otherwise, with s = v.size() and n = end − begin, fills the supplied range [begin, end) according to the following algorithm in which each operation is to be carried out modulo 232, each indexing operator applied to begin is to be taken modulo n, and T(x) is defined as x xor (x rshift 27):
// — By way of initialization, set each element of the range to the value 0x8b8b8b8b. Additionally, for use in subsequent steps, let p = (n − t)/2 and let q = p + t, where
t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
// — With m as the larger of s + 1 and n, transform the elements of the range: iteratively for k = 0, . . . , m − 1, calculate values r1 = 1664525 · T (begin[k] xor begin[k + p] xor begin[k − 1]) s ,k=0 r2 = r1+ kmodn+v[k−1] ,0<k≤s k mod n , s < k and, in order, increment begin[k + p] by r1, increment begin[k + q] by r2, and set begin[k] to r2.
// Each type instantiated from a class template specified in this subclause 28.5.9 meets the requirements of a random number distribution (28.5.3.6) type.
// Descriptions are provided in this subclause 28.5.9 only for distribution operations that are not described in 28.5.3.6 or for operations where there is additional semantic information. In particular, declarations for copy constructors, for copy assignment operators, for streaming operators, and for equality and inequality operators are not shown in the synopses.
// The algorithms for producing each of the specified distributions are implementation-defined.
// The value of each probability density function p(z) and of each discrete probability function P(zi) specified in this subclause is 0 everywhere outside its stated domain.
// — Transform the elements of the range again, beginning where the previous step ended: iteratively for k = m, . . . , m + n − 1, calculate values r3 = 1566083941 · T (begin[k] + begin[k + p] + begin[k − 1]) r4 = r3−(kmodn) and, in order, update begin[k + p] by xoring it with r3, update begin[k + q] by xoring it with r4, and set begin[k] to r4.
// Throws: What and when RandomAccessIterator operations of begin and end throw.
size_t size() const noexcept;
// Returns: The number of 32-bit units that would be returned by a call to param(). Complexity: Constant time.
template<class OutputIterator>
void param(OutputIterator dest) const;
// Mandates: Values of type result_type are writable (25.3.1) to dest.
// Preconditions: OutputIterator meets the Cpp17OutputIterator requirements (25.3.5.4).
// Effects: Copies the sequence of prepared 32-bit units to the given destination, as if by executing the following statement:
copy(v.begin(), v.end(), dest);
// Throws: What and when OutputIterator operations of dest throw.
// 28.5.8.2 Function template generate_canonical [rand.util.canonical]
template<class RealType, size_t bits, class URBG>
RealType generate_canonical(URBG& g);
// Effects: Invokes g() k times to obtain values g0, . . . , gk−1, respectively. Calculates a quantity using arithmetic of type RealType.
// Returns: S/Rk.
// [Note 1: 0 ≤ S/Rk < 1.
// Throws: What and when g throws. k−1 S = (gi − g.min()) · Ri i=0
// Complexity: Exactly k = max(1, ⌈b/ log2 R⌉) invocations of g, where b236 is the lesser of numeric_- limits<RealType>::digits and bits, and R is the value of g.max() − g.min() + 1.
// [Note 2: If the values gi produced by g are uniformly distributed, the instantiation’s results are distributed as uniformly as possible. Obtaining a value in this way can be a useful step in the process of transforming a value generated by a uniform random bit generator into a value that can be delivered by a random number distribution.
// 28.5.9 Random number distribution class templates [rand.dist]
// 28.5.9.1 In general [rand.dist.general]
// 28.5.9.2 Uniform distributions [rand.dist.uni]
// 28.5.9.2.1 Class template uniform_int_distribution tributed according to the constant discrete probability function [rand.dist.uni.int]
// A uniform_int_distribution random number distribution produces random integers i, a ≤ i ≤ b, dis-
namespace std {
template<class IntType = int>
class uniform_int_distribution {
public:
// types P (i | a, b) = 1/(b − a + 1) .
using result_type = IntType;
using param_type = unspecified ;
// constructors and reset functions
uniform_int_distribution() : uniform_int_distribution(0) {}
explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
explicit uniform_int_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const uniform_int_distribution& x, const uniform_int_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
result_type a() const;
result_type b() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const uniform_int_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, uniform_int_distribution& x);
};
}
explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
// Preconditions: a ≤ b.
// Remarks: a and b correspond to the respective parameters of the distribution.
// A uniform_real_distribution random number distribution produces random numbers x, a ≤ x < b, distributed according to the constant probability density function
result_type a() const;
// Returns: The value of the a parameter with which the object was constructed. result_type b() const;
// Returns: The value of the b parameter with which the object was constructed.
// 28.5.9.2.2 Class template uniform_real_distribution [rand.dist.uni.real]
// p(x | a, b) = 1/(b − a) .
// [Note 1: This implies that p(x|a,b) is undefined when a == b.
namespace std {
template<class RealType = double>
class uniform_real_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructors and reset functions
uniform_real_distribution() : uniform_real_distribution(0.0) {}
explicit uniform_real_distribution(RealType a, RealType b = 1.0);
explicit uniform_real_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const uniform_real_distribution& x,
const uniform_real_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
result_type a() const;
result_type b() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const uniform_real_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, uniform_real_distribution& x);
};
}
explicit uniform_real_distribution(RealType a, RealType b = 1.0);
// Preconditions: a ≤ b and b − a ≤ numeric_limits<RealType>::max().
// Remarks: a and b correspond to the respective parameters of the distribution.
// 28.5.9.3.1 Class bernoulli_distribution [rand.dist.bern.bernoulli] 1 A bernoulli_distribution random number distribution produces bool values b distributed according to result_type a() const;
// Returns: The value of the a parameter with which the object was constructed. result_type b() const;
// Returns: The value of the b parameter with which the object was constructed.
// 28.5.9.3 Bernoulli distributions [rand.dist.bern]
// the discrete probability function p P (b | p) = 1 − p ifb=true,or if b = false.
namespace std {
class bernoulli_distribution {
public:
// types
using result_type = bool;
using param_type = unspecified ;
// constructors and reset functions
bernoulli_distribution() : bernoulli_distribution(0.5) {}
explicit bernoulli_distribution(double p);
explicit bernoulli_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const bernoulli_distribution& x, const bernoulli_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
double p() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const bernoulli_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, bernoulli_distribution& x);
};
}
explicit bernoulli_distribution(double p);
// Preconditions: 0 ≤ p ≤ 1.
// Remarks: p corresponds to the parameter of the distribution.
// A binomial_distribution random number distribution produces integer values i ≥ 0 distributed according to the discrete probability function
double p() const;
// Returns: The value of the p parameter with which the object was constructed.
// 28.5.9.3.2 Class template binomial_distribution [rand.dist.bern.bin]
namespace std {
template<class IntType = int>
class binomial_distribution {
public:
// types
using result_type = IntType;
using param_type = unspecified ;
// t i t−i P(i|t,p)= i ·p ·(1−p) .
// constructors and reset functions
binomial_distribution() : binomial_distribution(1) {}
explicit binomial_distribution(IntType t, double p = 0.5);
explicit binomial_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const binomial_distribution& x, const binomial_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
IntType t() const;
double p() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const binomial_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, binomial_distribution& x);
};
}
explicit binomial_distribution(IntType t, double p = 0.5);
// Preconditions: 0≤p≤1and0≤t.
// Remarks: t and p correspond to the respective parameters of the distribution.
// A geometric_distribution random number distribution produces integer values i ≥ 0 distributed according to the discrete probability function
IntType t() const;
// Returns: The value of the t parameter with which the object was constructed. double p() const;
// Returns: The value of the p parameter with which the object was constructed.
// 28.5.9.3.3 Class template geometric_distribution [rand.dist.bern.geo]
namespace std {
template<class IntType = int>
class geometric_distribution {
public:
// types
using result_type = IntType;
using param_type = unspecified ;
// constructors and reset functions
geometric_distribution() : geometric_distribution(0.5) {}
explicit geometric_distribution(double p);
explicit geometric_distribution(const param_type& parm);
void reset();
P(i|p)=p·(1−p)i .
// equality operators
friend bool operator==(const geometric_distribution& x, const geometric_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
double p() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const geometric_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, geometric_distribution& x);
};
}
explicit geometric_distribution(double p);
// A negative_binomial_distribution random number distribution produces random integers i ≥ 0 dis- tributed according to the discrete probability function k+i−1 k i P(i|k,p)= i ·p ·(1−p) .
// [Note 1: This implies that P(i|k,p) is undefined when p == 1.
namespace std {
template<class IntType = int>
class negative_binomial_distribution {
public:
// types
using result_type = IntType;
using param_type = unspecified ;
// constructor and reset functions
negative_binomial_distribution() : negative_binomial_distribution(1) {}
explicit negative_binomial_distribution(IntType k, double p = 0.5);
explicit negative_binomial_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const negative_binomial_distribution& x,
const negative_binomial_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
// Preconditions: 0 < p < 1.
// Remarks: p corresponds to the parameter of the distribution.
double p() const;
// Returns: The value of the p parameter with which the object was constructed.
// 28.5.9.3.4 Class template negative_binomial_distribution [rand.dist.bern.negbin]
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
IntType k() const;
double p() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const negative_binomial_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, negative_binomial_distribution& x);
};
}
explicit negative_binomial_distribution(IntType k, double p = 0.5);
// Preconditions: 0<p≤1and0<k.
// Remarks: k and p correspond to the respective parameters of the distribution.
// 28.5.9.4.1 Class template poisson_distribution [rand.dist.pois.poisson] 1 A poisson_distribution random number distribution produces integer values i ≥ 0 distributed according to the discrete probability function e−μ μi P(i|μ)= i! . The distribution parameter μ is also known as this distribution’s mean.
template<class IntType = int>
class poisson_distribution
{
public:
// types
using result_type = IntType;
using param_type = unspecified ;
// constructors and reset functions
poisson_distribution() : poisson_distribution(1.0) {}
explicit poisson_distribution(double mean);
explicit poisson_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const poisson_distribution& x, const poisson_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
IntType k() const;
// Returns: The value of the k parameter with which the object was constructed. double p() const;
// Returns: The value of the p parameter with which the object was constructed.
// 28.5.9.4 Poisson distributions [rand.dist.pois]
// property functions
double mean() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const poisson_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, poisson_distribution& x);
};
explicit poisson_distribution(double mean);
// Preconditions: 0 < mean.
// Remarks: mean corresponds to the parameter of the distribution.
// An exponential_distribution random number distribution produces random numbers x > 0 distributed according to the probability density function
double mean() const;
// Returns: The value of the mean parameter with which the object was constructed.
// 28.5.9.4.2 Class template exponential_distribution [rand.dist.pois.exp]
namespace std {
template<class RealType = double>
class exponential_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructors and reset functions
p(x|λ) = λe−λx .
exponential_distribution() : exponential_distribution(1.0) {}
explicit exponential_distribution(RealType lambda);
explicit exponential_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const exponential_distribution& x, const exponential_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType lambda() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const exponential_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, exponential_distribution& x);
};
}
explicit exponential_distribution(RealType lambda);
// Preconditions: 0 < lambda.
// Remarks: lambda corresponds to the parameter of the distribution.
// A gamma_distribution random number distribution produces random numbers x > 0 distributed according to the probability density function e−x/β p(x|α,β)=βα·Γ(α) ·xα−1 .
namespace std {
template<class RealType = double>
class gamma_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructors and reset functions
gamma_distribution() : gamma_distribution(1.0) {}
explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
explicit gamma_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const gamma_distribution& x, const gamma_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType alpha() const;
RealType beta() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const gamma_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, gamma_distribution& x);
};
}
RealType lambda() const;
// Returns: The value of the lambda parameter with which the object was constructed.
// 28.5.9.4.3 Class template gamma_distribution [rand.dist.pois.gamma]
explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
// A weibull_distribution random number distribution produces random numbers x ≥ 0 distributed according to the probability density function
// Preconditions: 0 < alpha and 0 < beta.
// Remarks: alpha and beta correspond to the parameters of the distribution.
RealType alpha() const;
// Returns: The value of the alpha parameter with which the object was constructed. RealType beta() const;
// Returns: The value of the beta parameter with which the object was constructed.
// 28.5.9.4.4 Class template weibull_distribution [rand.dist.pois.weibull] a xa−1 p(x|a,b)=b· b
namespace std {
template<class RealType = double>
class weibull_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions xa ·exp − b .
// Preconditions: 0 < a and 0 < b.
// Remarks: a and b correspond to the respective parameters of the distribution.
weibull_distribution() : weibull_distribution(1.0) {}
explicit weibull_distribution(RealType a, RealType b = 1.0);
explicit weibull_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const weibull_distribution& x, const weibull_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType a() const;
RealType b() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const weibull_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, weibull_distribution& x);
};
}
explicit weibull_distribution(RealType a, RealType b = 1.0);
RealType a() const;
// Returns: The value of the a parameter with which the object was constructed. RealType b() const;
// Returns: The value of the b parameter with which the object was constructed.
// 28.5.9.4.5 Class template extreme_value_distribution [rand.dist.pois.extreme]
// An extreme_value_distribution random number distribution produces random numbers x distributed according to the probability density function237 p(x|a,b)= b ·exp
namespace std {
template<class RealType = double>
class extreme_value_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions b −exp b .
// a−x a−x
// Preconditions: 0 < b.
// Remarks: a and b correspond to the respective parameters of the distribution.
extreme_value_distribution() : extreme_value_distribution(0.0) {}
explicit extreme_value_distribution(RealType a, RealType b = 1.0);
explicit extreme_value_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const extreme_value_distribution& x,
const extreme_value_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType a() const;
RealType b() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const extreme_value_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, extreme_value_distribution& x);
};
}
explicit extreme_value_distribution(RealType a, RealType b = 1.0);
RealType a() const;
// Returns: The value of the a parameter with which the object was constructed. RealType b() const;
// A normal_distribution random number distribution produces random numbers x distributed according to the probability density function
// (x−μ)2 p(x|μ,σ)= σ√2π ·exp − 2σ2 . The distribution parameters μ and σ are also known as this distribution’s mean and standard deviation.
namespace std {
template<class RealType = double>
class normal_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructors and reset functions
normal_distribution() : normal_distribution(0.0) {}
explicit normal_distribution(RealType mean, RealType stddev = 1.0);
explicit normal_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const normal_distribution& x, const normal_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType mean() const;
RealType stddev() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const normal_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, normal_distribution& x);
};
}
explicit normal_distribution(RealType mean, RealType stddev = 1.0);
// Returns: The value of the b parameter with which the object was constructed.
// 28.5.9.5 Normal distributions [rand.dist.norm]
// 28.5.9.5.1 Class template normal_distribution [rand.dist.norm.normal]
// Preconditions: 0 < stddev.
// Remarks: mean and stddev correspond to the respective parameters of the distribution.
RealType mean() const;
// Returns: The value of the mean parameter with which the object was constructed.
RealType stddev() const;
// Returns: The value of the stddev parameter with which the object was constructed.
// 28.5.9.5.2 Class template lognormal_distribution [rand.dist.norm.lognormal]
// A lognormal_distribution random number distribution produces random numbers x > 0 distributed according to the probability density functioN
// p(x|m,s)= sx√2π ·exp
namespace std {
template<class RealType = double>
class lognormal_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions (lnx−m)2
// Preconditions: 0 < s.
// Remarks: m and s correspond to the respective parameters of the distribution.
lognormal_distribution() : lognormal_distribution(0.0) {}
explicit lognormal_distribution(RealType m, RealType s = 1.0);
explicit lognormal_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const lognormal_distribution& x, const lognormal_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType m() const;
RealType s() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const lognormal_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, lognormal_distribution& x);
};
}
explicit lognormal_distribution(RealType m, RealType s = 1.0);
RealType m() const;
// Returns: The value of the m parameter with which the object was constructed. RealType s() const;
// Returns: The value of the s parameter with which the object was constructed.
// 28.5.9.5.3 Class template chi_squared_distribution [rand.dist.norm.chisq]
// A chi_squared_distribution random number distribution produces random numbers x > 0 distributed according to the probability density function p(x|n)= Γ(n/2)·2n/2 .
namespace std {
template<class RealType = double>
class chi_squared_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions
chi_squared_distribution() : chi_squared_distribution(1.0) {}
explicit chi_squared_distribution(RealType n);
explicit chi_squared_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const chi_squared_distribution& x, const chi_squared_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType n() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const chi_squared_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, chi_squared_distribution& x);
};
}
explicit chi_squared_distribution(RealType n);
// Preconditions: 0 < n.
// Remarks: n corresponds to the parameter of the distribution. x(n/2)−1 · e−x/2
// A cauchy_distribution random number distribution produces random numbers x distributed according to the probability density function x − a 2 −1 p(x|a,b)= πb 1+ b .
RealType n() const;
// Returns: The value of the n parameter with which the object was constructed.
// 28.5.9.5.4 Class template cauchy_distribution [rand.dist.norm.cauchy]
namespace std {
template<class RealType = double>
class cauchy_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions
cauchy_distribution() : cauchy_distribution(0.0) {}
explicit cauchy_distribution(RealType a, RealType b = 1.0);
explicit cauchy_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const cauchy_distribution& x, const cauchy_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType a() const;
RealType b() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const cauchy_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, cauchy_distribution& x);
};
}
explicit cauchy_distribution(RealType a, RealType b = 1.0);
// Preconditions: 0 < b.
// Remarks: a and b correspond to the respective parameters of the distribution.
// A fisher_f_distribution random number distribution produces random numbers x ≥ 0 distributed according to the probability density function
RealType a() const;
// Returns: The value of the a parameter with which the object was constructed. RealType b() const;
// Returns: The value of the b parameter with which the object was constructed.
// 28.5.9.5.5 Class template fisher_f_distribution [rand.dist.norm.f]
// Γ(m + n)/2 m m/2 (m/2)−1 p(x|m,n)=Γ(m/2)Γ(n/2)· n ·x
// mx −(m+n)/2 · 1+ n .
namespace std {
template<class RealType = double>
class fisher_f_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions
fisher_f_distribution() : fisher_f_distribution(1.0) {}
explicit fisher_f_distribution(RealType m, RealType n = 1.0);
explicit fisher_f_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const fisher_f_distribution& x, const fisher_f_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType m() const;
RealType n() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const fisher_f_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, fisher_f_distribution& x);
};
}
explicit fisher_f_distribution(RealType m, RealType n = 1);
// Preconditions: 0 < m and 0 < n.
// Remarks: m and n correspond to the respective parameters of the distribution.
// A student_t_distribution random number distribution produces random numbers x distributed according to the probability density function
// Γ(n + 1)/2 x2 −(n+1)/2 p(x|n)=√nπ· Γ(n/2) · 1+ n .
RealType m() const;
// Returns: The value of the m parameter with which the object was constructed. RealType n() const;
// Returns: The value of the n parameter with which the object was constructed.
// 28.5.9.5.6 Class template student_t_distribution [rand.dist.norm.t]
namespace std {
template<class RealType = double>
class student_t_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions
student_t_distribution() : student_t_distribution(1.0) {}
explicit student_t_distribution(RealType n);
explicit student_t_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const student_t_distribution& x, const student_t_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
RealType n() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const student_t_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, student_t_distribution& x);
};
}
explicit student_t_distribution(RealType n);
// Preconditions: 0 < n.
// Remarks: n corresponds to the parameter of the distribution.
// 28.5.9.6.1 Class template discrete_distribution [rand.dist.samp.discrete]
// A discrete_distribution random number distribution produces random integers i, 0 ≤ i < n, distributed according to the discrete probability function P(i|p0,...,pn−1) = pi . Unlessspecifiedotherwise,thedistributionparametersarecalculatedas:pk=wk/Sfork=0,...,n−1, in which the values wk, commonly known as the weights, shall be non-negative, non-NaN, and non-infinity. Moreover, the following relation shall hold: 0 < S = w0 + · · · + wn−1 .
namespace std {
template<class IntType = int>
class discrete_distribution {
public:
RealType n() const;
// Returns: The value of the n parameter with which the object was constructed.
// 28.5.9.6 Sampling distributions [rand.dist.samp]
// types
using result_type = IntType;
using param_type = unspecified ;
// constructor and reset functions
discrete_distribution();
template<class InputIterator>
discrete_distribution(InputIterator firstW, InputIterator lastW);
discrete_distribution(initializer_list<double> wl);
template<class UnaryOperation>
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
explicit discrete_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const discrete_distribution& x, const discrete_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
vector<double> probabilities() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const discrete_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, discrete_distribution& x);
};
}
discrete_distribution();
// Effects: Constructs a discrete_distribution object with n = 1 and p0 = 1. // [Note 1: Such an object will always deliver the value 0.
template<class InputIterator>
discrete_distribution(InputIterator firstW, InputIterator lastW);
// Mandates: is_convertible_v<iterator_traits<InputIterator>::value_type, double> is true. Preconditions: InputIterator meets the Cpp17InputIterator requirements (25.3.5.3). If firstW == lastW, let n = 1 and w0 = 1. Otherwise, firstW, lastW forms a sequence w of length n > 0.
// Effects: Constructs a discrete_distribution object with probabilities given by the formula above.
discrete_distribution(initializer_list<double> wl);
// Effects: Same as discrete_distribution(wl.begin(), wl.end()). template<class UnaryOperation>
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
// Mandates: is_invocable_r_v<double, UnaryOperation&, double> is true.
// Preconditions: If nw = 0, let n = 1, otherwise let n = nw. The relation 0 < δ = (xmax − xmin)/n holds.
// Effects: Constructs a discrete_distribution object with probabilities given by the formula above, using the following values: If nw = 0, let w0 = 1. Otherwise, let wk = fw(xmin + k · δ + δ/2) for k = 0, . . . , n − 1.
// Complexity: The number of invocations of fw does not exceed n. vector<double> probabilities() const;
// Returns: A vector<double> whose size member returns n and whose operator[] member returns pk wheninvokedwithargumentkfork=0,...,n−1.
// 28.5.9.6.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst]
// A piecewise_constant_distribution random number distribution produces random numbers x, b0 ≤ x < bn, uniformly distributed over each subinterval [bi,bi+1) according to the probability density function p(x|b0,...,bn, ρ0,...,ρn−1) = ρi , for bi ≤ x < bi+1.
// The n + 1 distribution parameters bi, also known as this distribution’s interval boundaries, shall satisfy the relation bi < bi+1 for i = 0, . . . , n − 1. Unless specified otherwise, the remaining n distribution parameters are calculated as: in which the values wk, commonly known as the weights, shall be non-negative, non-NaN, and non-infinity. Moreover, the following relation shall hold: 0 < S = w0 + · · · + wn−1 .
namespace std {
template<class RealType = double>
class piecewise_constant_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions
piecewise_constant_distribution();
template<class InputIteratorB, class InputIteratorW>
piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB,
InputIteratorW firstW);
template<class UnaryOperation>
piecewise_constant_distribution(initializer_list<RealType> bl, UnaryOperation fw);
template<class UnaryOperation>
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax,
UnaryOperation fw);
explicit piecewise_constant_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const piecewise_constant_distribution& x,
const piecewise_constant_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
vector<result_type> intervals() const;
vector<result_type> densities() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// ρk = wk fork=0,...,n−1, S · (bk+1 − bk)
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const piecewise_constant_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, piecewise_constant_distribution& x);
};
}
piecewise_constant_distribution();
// Effects: Constructs a piecewise_constant_distribution object with n = 1, ρ0 = 1, b0 = 0, and b1 = 1.
template<class InputIteratorB, class InputIteratorW>
piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB,
InputIteratorW firstW);
// Mandates: Both of
// — is_convertible_v<iterator_traits<InputIteratorB>::value_type, double> // — is_convertible_v<iterator_traits<InputIteratorW>::value_type, double> are true.
// Preconditions: InputIteratorB and InputIteratorW each meet the Cpp17InputIterator requirements (25.3.5.3). If firstB == lastB or ++firstB == lastB, let n = 1, w0 = 1, b0 = 0, and b1 = 1. Otherwise, firstB, lastB forms a sequence b of length n + 1, the length of the sequence w starting from firstW is at least n, and any wk for k ≥ n are ignored by the distribution.
// Effects: Constructs a piecewise_constant_distribution object with parameters as specified above.
template<class UnaryOperation>
piecewise_constant_distribution(initializer_list<RealType> bl, UnaryOperation fw);
// Mandates: is_invocable_r_v<double, UnaryOperation&, double> is true.
// Effects: Constructs a piecewise_constant_distribution object with parameters taken or calculated from the following values: If bl.size() < 2, let n = 1, w0 = 1, b0 = 0, and b1 = 1. Otherwise, let bl.begin(),bl.end()formasequenceb0,...,bn,andletwk =fwbk+1+bk/2fork=0,...,n−1.
// Complexity: The number of invocations of fw does not exceed n. template<class UnaryOperation>
piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
// Mandates: is_invocable_r_v<double, UnaryOperation&, double> is true.
//Preconditions: If nw = 0, let n = 1, otherwise let n = nw. The relation 0 < δ = (xmax − xmin)/n holds.
//Effects: Constructs a piecewise_constant_distribution object with parameters taken or calculated from the following values: Let bk = xmin+k·δ for k = 0,...,n, and wk = fw(bk+δ/2) for k = 0,...,n−1.
//Complexity: The number of invocations of fw does not exceed n. vector<result_type> intervals() const;
//Returns: A vector<result_type> whose size member returns n + 1 and whose operator[] member returns bk when invoked with argument k for k = 0, . . . , n.
vector<result_type> densities() const;
// Returns: A vector<result_type> whose size member returns n and whose operator[] member returnsρk wheninvokedwithargumentkfork=0,...,n−1.
// 28.5.9.6.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear]
// A piecewise_linear_distribution random number distribution produces random numbers x, b0 ≤ x < bn,distributed over each subinterval [bi,bi+1) according to the probability density function p(x|b0,...,bn,ρ0,...,ρn)=ρi·bi+1−x+ρi+1· x−bi ,forbi≤x<bi+1. bi+1 − bi bi+1 − bi
// Effects: Constructs a piecewise_linear_distribution object with n = 1, ρ0 = ρ1 = 1, b0 = 0, and b1 = 1.
// The n + 1 distribution parameters bi, also known as this distribution’s interval boundaries, shall satisfy the relation bi < bi+1 for i = 0, . . . , n − 1. Unless specified otherwise, the remaining n + 1 distribution parameters are calculated as ρk = wk/S for k = 0, . . . , n, in which the values wk, commonly known as the weights at boundaries, shall be non-negative, non-NaN, and non-infinity. Moreover, the following relation shall hold: 1 n−1 0 < S = 2 · (wk + wk+1) · (bk+1 − bk) . k=0
piecewise_linear_distribution();
template<class InputIteratorB, class InputIteratorW>
piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
InputIteratorW firstW);
template<class UnaryOperation>
piecewise_linear_distribution(initializer_list<RealType> bl, UnaryOperation fw);
template<class UnaryOperation>
piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
explicit piecewise_linear_distribution(const param_type& parm);
void reset();
// equality operators
friend bool operator==(const piecewise_linear_distribution& x,
const piecewise_linear_distribution& y);
// generating functions
template<class URBG>
result_type operator()(URBG& g);
template<class URBG>
result_type operator()(URBG& g, const param_type& parm);
// property functions
vector<result_type> intervals() const;
vector<result_type> densities() const;
param_type param() const;
void param(const param_type& parm);
result_type min() const;
result_type max() const;
// inserters and extractors
template<class charT, class traits>
friend basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const piecewise_linear_distribution& x);
template<class charT, class traits>
friend basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
};
}
piecewise_linear_distribution();
namespace std {
template<class RealType = double>
class piecewise_linear_distribution {
public:
// types
using result_type = RealType;
using param_type = unspecified ;
// constructor and reset functions
template<class InputIteratorB, class InputIteratorW>
piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
InputIteratorW firstW);
// Mandates: is_invocable_r_v<double, UnaryOperation&, double> is true.
// Preconditions: InputIteratorB and InputIteratorW each meet the Cpp17InputIterator requirements (25.3.5.3). If firstB == lastB or ++firstB == lastB, let n = 1, ρ0 = ρ1 = 1, b0 = 0, and b1 = 1. Otherwise, firstB, lastB forms a sequence b of length n + 1, the length of the sequence w starting from firstW is at least n + 1, and any wk for k ≥ n + 1 are ignored by the distribution.
// Effects: Constructs a piecewise_linear_distribution object with parameters as specified above.
// Effects: The rand and srand functions have the semantics specified in the C standard library. Remarks: The implementation may specify that particular library functions may call rand. It is implementation-defined whether the rand function may introduce data races (16.4.6.10).
// [Note 2: The other random number generation facilities in this document (28.5) are often preferable to rand, because rand’s underlying algorithm is unspecified. Use of rand therefore continues to be non-portable, with unpredictable and oft-questionable quality and performance.
template<class UnaryOperation>
piecewise_linear_distribution(initializer_list<RealType> bl, UnaryOperation fw);
// Mandates: is_invocable_r_v<double, UnaryOperation&, double> is true.
// Effects: Constructs a piecewise_linear_distribution object with parameters taken or calculated from the following values: If bl.size() < 2, let n = 1, ρ0 = ρ1 = 1, b0 = 0, and b1 = 1. Otherwise, let bl.begin(),bl.end() form a sequence b0, . . . , bn, and let wk = fw(bk) for k = 0, . . . , n.
// Complexity: The number of invocations of fw does not exceed n + 1. template<class UnaryOperation>
piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
// Mandates: is_invocable_r_v<double, UnaryOperation&, double> is true.
// Preconditions: If nw = 0, let n = 1, otherwise let n = nw. The relation 0 < δ = (xmax − xmin)/n holds.
// Effects: Constructs a piecewise_linear_distribution object with parameters taken or calculated from the following values: Let bk = xmin + k · δ for k = 0, . . . , n, and wk = fw(bk ) for k = 0, . . . , n.
//Complexity: The number of invocations of fw does not exceed n + 1.
vector<result_type> intervals() const;
// Returns: A vector<result_type> whose size member returns n + 1 and whose operator[] member returns bk when invoked with argument k for k = 0, . . . , n.
vector<result_type> densities() const;
// Returns: A vector<result_type> whose size member returns n and whose operator[] member returns ρk when invoked with argument k for k = 0, . . . , n.
// 28.5.10 Low-quality random number generation [c.math.rand]
// [Note 1 : The header <cstdlib> (17.2.2) declares the functions described in this subclause. int rand();
void srand(unsigned int seed);
};
}
// See also: ISO C 7.22.2
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p1278.cpp -std=03 -o p1278l -I. -Wall
In file included from p1278.cpp:10:
In file included from ./N4910.h:11:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
p1278.cpp:31:1: error: unknown type name 'concept'
concept uniform_random_bit_generator = see below;
^
p1278.cpp:31:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept uniform_random_bit_generator = see below;
^
p1278.cpp:31:40: error: use of undeclared identifier 'see'
concept uniform_random_bit_generator = see below;
^
p1278.cpp:31:43: error: expected ';' at end of declaration
concept uniform_random_bit_generator = see below;
^
;
p1278.cpp:31:44: error: C++ requires a type specifier for all declarations
concept uniform_random_bit_generator = see below;
^
p1278.cpp:54:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using minstd_rand0 = see_below;
^
p1278.cpp:54:22: error: unknown type name 'see_below'
p1278.cpp:55:21: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using minstd_rand = see_below;
^
p1278.cpp:55:21: error: unknown type name 'see_below'
p1278.cpp:56:17: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using mt19937 = see_below;
^
p1278.cpp:56:17: error: unknown type name 'see_below'
p1278.cpp:57:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using mt19937_64 = see_below;
^
p1278.cpp:57:20: error: unknown type name 'see_below'
p1278.cpp:58:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using ranlux24_base = see_below;
^
p1278.cpp:58:23: error: unknown type name 'see_below'
p1278.cpp:59:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using ranlux48_base = see_below;
^
p1278.cpp:59:23: error: unknown type name 'see_below'
p1278.cpp:60:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using ranlux24 = see_below;
^
p1278.cpp:60:18: error: unknown type name 'see_below'
p1278.cpp:61:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using ranlux48 = see_below;
^
p1278.cpp:61:18: error: unknown type name 'see_below'
p1278.cpp:62:17: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using knuth_b = see_below;
^
p1278.cpp:62:17: error: unknown type name 'see_below'
p1278.cpp:97:23: error: expected '>'
emplate<class RealType = double>
^
p1278.cpp:97:8: note: to match this '<'
emplate<class RealType = double>
^
p1278.cpp:97:24: error: expected unqualified-id
emplate<class RealType = double>
^
p1278.cpp:162:8: error: unknown type name 'concept'
concept uniform_random_bit_generator =
^
p1278.cpp:162:16: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept uniform_random_bit_generator =
^
p1278.cpp:163:63: error: a space is required between consecutive right angle brackets (use '> >')
invocable<G&> && unsigned_integral<invoke_result_t<G&>> &&
^~
> >
p1278.cpp:163:45: error: use of undeclared identifier 'invoke_result_t'
invocable<G&> && unsigned_integral<invoke_result_t<G&>> &&
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
11 warnings and 20 errors generated.
$ clang++ p1278.cpp -std=2b -o p1278l -I. -Wall
p1278.cpp:31:40: error: use of undeclared identifier 'see'
concept uniform_random_bit_generator = see below;
^
p1278.cpp:54:22: error: unknown type name 'see_below'
using minstd_rand0 = see_below;
^
p1278.cpp:55:21: error: unknown type name 'see_below'
using minstd_rand = see_below;
^
p1278.cpp:56:17: error: unknown type name 'see_below'
using mt19937 = see_below;
^
p1278.cpp:57:20: error: unknown type name 'see_below'
using mt19937_64 = see_below;
^
p1278.cpp:58:23: error: unknown type name 'see_below'
using ranlux24_base = see_below;
^
p1278.cpp:59:23: error: unknown type name 'see_below'
using ranlux48_base = see_below;
^
p1278.cpp:60:18: error: unknown type name 'see_below'
using ranlux24 = see_below;
^
p1278.cpp:61:18: error: unknown type name 'see_below'
using ranlux48 = see_below;
^
p1278.cpp:62:17: error: unknown type name 'see_below'
using knuth_b = see_below;
^
p1278.cpp:71:26: error: template parameter redefines default argument
template<class IntType = int>
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/uniform_int_dist.h:73:32: note: previous default template argument defined here
template<typename _IntType = int>
^
p1278.cpp:97:23: error: expected '>'
emplate<class RealType = double>
^
p1278.cpp:97:8: note: to match this '<'
emplate<class RealType = double>
^
p1278.cpp:97:24: error: expected unqualified-id
emplate<class RealType = double>
^
p1278.cpp:203:1: error: use of undeclared identifier 'A'
A::A();
^
p1278.cpp:276:36: error: C++ requires a type specifier for all declarations
template<class Sseq> explicit X(Sseq& q);
~~~~~~~~ ^
p1278.cpp:282:36: error: class member cannot be redeclared
template<class Sseq> void seed(Sseq& q);
^
p1278.cpp:279:32: note: previous declaration is here
template<class Sseq> void seed(Sseq& q);
^
p1278.cpp:301:40: error: unknown type name 'result_type'
explicit linear_congruential_engine(result_type s);
^
p1278.cpp:301:13: error: deduction guide must be declared in the same scope as template 'std::linear_congruential_engine'
explicit linear_congruential_engine(result_type s);
^
p1278.cpp:259:16: note: template is declared here
class linear_congruential_engine {
^
p1278.cpp:301:13: error: deduction guide declaration without trailing return type
explicit linear_congruential_engine(result_type s);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++ p1278.cpp -std=03 -o p1278g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p1278.cpp:10:
/usr/local/include/c++/12.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
32 | #error This file requires compiler and library support \
| ^~~~~
p1278.cpp:264:19: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
264 | static constexpr result_type multiplier = a;
| ^~~~~~~~~
p1278.cpp:341:45: error: invalid suffix "w" on integer constant
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^~
p1278.cpp:341:48: error: extended character − is not valid in an identifier
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^
p1278.cpp:382:94: error: extended character − is not valid in an identifier
382 | c constexpr result_type min() { return 0; } static constexpr result_type max() { return m−1; } static constexpr result_type default_seed = 19780503u;
| ^
p1278.cpp:454:37: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
454 | const Engine& base() const noexcept { return e; };
| ^~~~~~~~
p1278.cpp:478:32: error: extended character ≥ is not valid in an identifier
478 | do u = e() - e.min(); while (u ≥ y0);
| ^
p1278.cpp:479:5: error: invalid suffix "w0" on integer constant
479 | S = 2w0 ·S+umod2w0; }
| ^~~
p1278.cpp:481:32: error: extended character ≥ is not valid in an identifier
481 | do u = e() - e.min(); while (u ≥ y1); S = 2w0+1 ·S+umod2w0+1;
| ^
p1278.cpp:481:43: error: invalid suffix "w0" on integer constant
481 | do u = e() - e.min(); while (u ≥ y1); S = 2w0+1 ·S+umod2w0+1;
| ^~~
p1278.cpp:489:94: error: invalid suffix "w" on integer constant
489 | tic constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^~
p1278.cpp:489:97: error: extended character − is not valid in an identifier
489 | tic constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^
p1278.cpp:568:44: error: extended character ’ is not valid in an identifier
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^
p1278.cpp:568:44: error: invalid suffix "’807" on integer constant
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^~~~~~
p1278.cpp:568:55: error: extended character ’ is not valid in an identifier
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^
p1278.cpp:568:55: error: extended character ’ is not valid in an identifier
p1278.cpp:568:55: error: extended character ’ is not valid in an identifier
p1278.cpp:568:55: error: invalid suffix "’147’483’647" on integer constant
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^~~~~~~~~~~~~
p1278.cpp:576:49: error: extended character ’ is not valid in an identifier
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^
p1278.cpp:576:49: error: invalid suffix "’271" on integer constant
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^~~~~~
p1278.cpp:576:60: error: extended character ’ is not valid in an identifier
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^
p1278.cpp:576:60: error: extended character ’ is not valid in an identifier
p1278.cpp:576:60: error: extended character ’ is not valid in an identifier
p1278.cpp:576:60: error: invalid suffix "’147’483’647" on integer constant
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^~~~~~~~~~~~~
p1278.cpp:579:64: error: extended character ’ is not valid in an identifier
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:64: error: invalid suffix "’b0df" on integer constant
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:81: error: extended character ’ is not valid in an identifier
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:81: error: invalid suffix "’ffff" on integer constant
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:97: error: extended character ’ is not valid in an identifier
579 | rsenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:97: error: invalid suffix "’5680" on integer constant
579 | rsenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:114: error: extended character ’ is not valid in an identifier
579 | gine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:114: error: invalid suffix "’0000" on integer constant
579 | gine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:131: error: extended character ’ is not valid in an identifier
579 | t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:131: error: extended character ’ is not valid in an identifier
p1278.cpp:579:131: error: extended character ’ is not valid in an identifier
p1278.cpp:579:131: error: invalid suffix "’812’433’253" on integer constant
579 | t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~~~
p1278.cpp:582:64: error: extended character ’ is not valid in an identifier
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^
p1278.cpp:582:64: error: extended character ’ is not valid in an identifier
p1278.cpp:582:64: error: extended character ’ is not valid in an identifier
p1278.cpp:582:64: error: invalid suffix "’6f5a’a966’19e9" on integer constant
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:582:91: error: extended character ’ is not valid in an identifier
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^
p1278.cpp:582:91: error: extended character ’ is not valid in an identifier
p1278.cpp:582:91: error: extended character ’ is not valid in an identifier
p1278.cpp:582:91: error: invalid suffix "’5555’5555’5555" on integer constant
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:583:3: error: extended character ’ is not valid in an identifier
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:3: error: extended character ’ is not valid in an identifier
p1278.cpp:583:3: error: extended character ’ is not valid in an identifier
p1278.cpp:583:3: error: invalid suffix "’7fff’eda6’0000" on integer constant
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:583:30: error: extended character ’ is not valid in an identifier
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:30: error: extended character ’ is not valid in an identifier
p1278.cpp:583:30: error: extended character ’ is not valid in an identifier
p1278.cpp:583:30: error: invalid suffix "’eee0’0000’0000" on integer constant
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: invalid suffix "’364’136’223’846’793’005" on integer constant
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:668:4: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:17: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:28: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:39: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:49: error: extended character − is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:876:11: error: extended character − is not valid in an identifier
876 | P(i|p)=p·(1−p)i .
| ^
p1278.cpp:876:11: error: invalid suffix "−p" on integer constant
876 | P(i|p)=p·(1−p)i .
| ^~~
p1278.cpp:994:10: error: extended character − is not valid in an identifier
994 | p(x|λ) = λe−λx .
| ^
p1278.cpp:31:1: error: 'concept' does not name a type
31 | concept uniform_random_bit_generator = see below;
| ^~~~~~~
p1278.cpp:31:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p1278.cpp:54:7: error: expected nested-name-specifier before 'minstd_rand0'
54 | using minstd_rand0 = see_below;
| ^~~~~~~~~~~~
p1278.cpp:55:7: error: expected nested-name-specifier before 'minstd_rand'
55 | using minstd_rand = see_below;
| ^~~~~~~~~~~
p1278.cpp:56:7: error: expected nested-name-specifier before 'mt19937'
56 | using mt19937 = see_below;
| ^~~~~~~
p1278.cpp:57:7: error: expected nested-name-specifier before 'mt19937_64'
57 | using mt19937_64 = see_below;
| ^~~~~~~~~~
p1278.cpp:58:7: error: expected nested-name-specifier before 'ranlux24_base'
58 | using ranlux24_base = see_below;
| ^~~~~~~~~~~~~
p1278.cpp:59:7: error: expected nested-name-specifier before 'ranlux48_base'
59 | using ranlux48_base = see_below;
| ^~~~~~~~~~~~~
p1278.cpp:60:7: error: expected nested-name-specifier before 'ranlux24'
60 | using ranlux24 = see_below;
| ^~~~~~~~
p1278.cpp:61:7: error: expected nested-name-specifier before 'ranlux48'
61 | using ranlux48 = see_below;
| ^~~~~~~~
p1278.cpp:62:7: error: expected nested-name-specifier before 'knuth_b'
62 | using knuth_b = see_below;
| ^~~~~~~
p1278.cpp:97:1: error: 'emplate' does not name a type
97 | emplate<class RealType = double>
| ^~~~~~~
p1278.cpp:162:8: error: 'concept' does not name a type; did you mean 'const'?
162 | concept uniform_random_bit_generator =
| ^~~~~~~
| const
p1278.cpp:162:8: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p1278.cpp:203:1: error: 'A' does not name a type
203 | A::A();
| ^
p1278.cpp:262:18: error: expected nested-name-specifier before 'result_type'
262 | using result_type = UIntType;
| ^~~~~~~~~~~
p1278.cpp:264:19: error: 'constexpr' does not name a type
264 | static constexpr result_type multiplier = a;
| ^~~~~~~~~
p1278.cpp:264:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:265:19: error: 'constexpr' does not name a type
265 | static constexpr result_type increment = c;
| ^~~~~~~~~
p1278.cpp:265:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:266:19: error: 'constexpr' does not name a type
266 | static constexpr result_type modulus = m;
| ^~~~~~~~~
p1278.cpp:266:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:267:19: error: 'constexpr' does not name a type
267 | static constexpr result_type min() { return c == 0u ? 1u: 0u; }
| ^~~~~~~~~
p1278.cpp:267:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:268:19: error: 'constexpr' does not name a type
268 | static constexpr result_type max() { return m - 1u; }
| ^~~~~~~~~
p1278.cpp:268:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:269:19: error: 'constexpr' does not name a type
269 | static constexpr result_type default_seed = 1u;
| ^~~~~~~~~
p1278.cpp:269:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:272:59: error: expected ')' before 's'
272 | explicit linear_congruential_engine(result_type s);
| ~ ^~
| )
p1278.cpp:274:22: error: 'result_type' has not been declared
274 | void seed(result_type s = default_seed);
| ^~~~~~~~~~~
p1278.cpp:276:36: error: ISO C++ forbids declaration of 'X' with no type [-fpermissive]
276 | template<class Sseq> explicit X(Sseq& q);
| ^
p1278.cpp:276:27: error: only declarations of constructors and conversion operators can be 'explicit'
276 | template<class Sseq> explicit X(Sseq& q);
| ^~~~~~~~
p1278.cpp:282:36: error: 'template<class UIntType, UIntType a, UIntType c, UIntType m> template<class Sseq> void std::linear_congruential_engine<UIntType, a, c, m>::seed(Sseq&)' cannot be overloaded with 'template<class UIntType, UIntType a, UIntType c, UIntType m> template<class Sseq> void std::linear_congruential_engine<UIntType, a, c, m>::seed(Sseq&)'
282 | template<class Sseq> void seed(Sseq& q);
| ^~~~
p1278.cpp:279:32: note: previous declaration 'template<class UIntType, UIntType a, UIntType c, UIntType m> template<class Sseq> void std::linear_congruential_engine<UIntType, a, c, m>::seed(Sseq&)'
279 | template<class Sseq> void seed(Sseq& q);
| ^~~~
p1278.cpp:285:68: warning: friend declaration 'bool std::operator==(const linear_congruential_engine<UIntType, a, c, m>&, const linear_congruential_engine<UIntType, a, c, m>&)' declares a non-template function [-Wnon-template-friend]
285 | const linear_congruential_engine& y);
| ^
p1278.cpp:285:68: note: (if this is not what you intended, make sure the function template has already been declared and add '<>' after the function name here)
p1278.cpp:287:10: error: 'result_type' does not name a type
287 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:274:38: error: 'default_seed' was not declared in this scope
274 | void seed(result_type s = default_seed);
| ^~~~~~~~~~~~
p1278.cpp: In constructor 'std::linear_congruential_engine<UIntType, a, c, m>::linear_congruential_engine()':
p1278.cpp:271:70: error: 'default_seed' was not declared in this scope
271 | linear_congruential_engine() : linear_congruential_engine(default_seed) {}
| ^~~~~~~~~~~~
p1278.cpp:271:82: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
271 | linear_congruential_engine() : linear_congruential_engine(default_seed) {}
| ^
p1278.cpp: At global scope:
p1278.cpp:301:13: error: ISO C++ forbids declaration of 'linear_congruential_engine' with no type [-fpermissive]
301 | explicit linear_congruential_engine(result_type s);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:301:4: error: 'explicit' outside class declaration
301 | explicit linear_congruential_engine(result_type s);
| ^~~~~~~~
p1278.cpp:301:40: error: 'result_type' was not declared in this scope
301 | explicit linear_congruential_engine(result_type s);
| ^~~~~~~~~~~
p1278.cpp:309:31: error: ISO C++ forbids declaration of 'linear_congruential_engine' with no type [-fpermissive]
309 | template<class Sseq> explicit linear_congruential_engine(Sseq& q);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:309:22: error: 'explicit' outside class declaration
309 | template<class Sseq> explicit linear_congruential_engine(Sseq& q);
| ^~~~~~~~
p1278.cpp:309:65: error: 'template<class Sseq> int linear_congruential_engine(Sseq&)' redeclared as different kind of entity
309 | template<class Sseq> explicit linear_congruential_engine(Sseq& q);
| ^
p1278.cpp:301:13: note: previous declaration 'int linear_congruential_engine'
301 | explicit linear_congruential_engine(result_type s);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:315:10: error: ISO C++ forbids declaration of 'mersenne_twister_engine' with no type [-fpermissiv]
315 | explicit mersenne_twister_engine(result_type value);
| ^~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:315:1: error: 'explicit' outside class declaration
315 | explicit mersenne_twister_engine(result_type value);
| ^~~~~~~~
p1278.cpp:315:34: error: 'result_type' was not declared in this scope
315 | explicit mersenne_twister_engine(result_type value);
| ^~~~~~~~~~~
p1278.cpp:325:16: error: expected nested-name-specifier before 'result_type'
325 | using result_type = UIntType;
| ^~~~~~~~~~~
p1278.cpp:327:17: error: 'constexpr' does not name a type
327 | static constexpr size_t word_size = w;
| ^~~~~~~~~
p1278.cpp:327:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:328:17: error: 'constexpr' does not name a type
328 | static constexpr size_t state_size = n;
| ^~~~~~~~~
p1278.cpp:328:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:329:17: error: 'constexpr' does not name a type
329 | static constexpr size_t shift_size = m;
| ^~~~~~~~~
p1278.cpp:329:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:330:17: error: 'constexpr' does not name a type
330 | static constexpr size_t mask_bits = r;
| ^~~~~~~~~
p1278.cpp:330:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:331:17: error: 'constexpr' does not name a type
331 | static constexpr UIntType xor_mask = a;
| ^~~~~~~~~
p1278.cpp:331:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:332:17: error: 'constexpr' does not name a type
332 | static constexpr size_t tempering_u = u;
| ^~~~~~~~~
p1278.cpp:332:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:333:17: error: 'constexpr' does not name a type
333 | static constexpr UIntType tempering_d = d;
| ^~~~~~~~~
p1278.cpp:333:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:334:17: error: 'constexpr' does not name a type
334 | static constexpr size_t tempering_s = s;
| ^~~~~~~~~
p1278.cpp:334:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:335:17: error: 'constexpr' does not name a type
335 | static constexpr UIntType tempering_b = b;
| ^~~~~~~~~
p1278.cpp:335:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:336:17: error: 'constexpr' does not name a type
336 | static constexpr size_t tempering_t = t;
| ^~~~~~~~~
p1278.cpp:336:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:337:17: error: 'constexpr' does not name a type
337 | static constexpr UIntType tempering_c = c;
| ^~~~~~~~~
p1278.cpp:337:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:338:17: error: 'constexpr' does not name a type
338 | static constexpr size_t tempering_l = l;
| ^~~~~~~~~
p1278.cpp:338:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:339:17: error: 'constexpr' does not name a type
339 | static constexpr UIntType initialization_multiplier = f;
| ^~~~~~~~~
p1278.cpp:339:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:340:17: error: 'constexpr' does not name a type
340 | static constexpr result_type min() { return 0; }
| ^~~~~~~~~
p1278.cpp:340:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:341:8: error: 'constexpr' does not name a type
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^~~~~~~~~
p1278.cpp:341:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:341:62: error: 'constexpr' does not name a type
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^~~~~~~~~
p1278.cpp:341:62: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:344:54: error: expected ')' before 'value'
344 | explicit mersenne_twister_engine(result_type value);
| ~ ^~~~~~
| )
p1278.cpp:346:20: error: 'result_type' has not been declared
346 | void seed(result_type value = default_seed);
| ^~~~~~~~~~~
p1278.cpp:349:99: warning: friend declaration 'bool std::operator==(const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>&, const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>&)' declares a non-template function [-Wnon-template-friend]
349 | friend bool operator==(const mersenne_twister_engine& x, const mersenne_twister_engine& y);
| ^
p1278.cpp:351:10: error: 'result_type' does not name a type
351 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:346:40: error: 'default_seed' was not declared in this scope
346 | void seed(result_type value = default_seed);
| ^~~~~~~~~~~~
p1278.cpp: In constructor 'std::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::mersenne_twister_engine()':
p1278.cpp:343:62: error: 'default_seed' was not declared in this scope
343 | mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
| ^~~~~~~~~~~~
p1278.cpp:343:74: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
343 | mersenne_twister_engine() : mersenne_twister_engine(default_seed) {}
| ^
p1278.cpp: At global scope:
p1278.cpp:364:31: error: ISO C++ forbids declaration of 'mersenne_twister_engine' with no type [-fpermissiv]
364 | template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
| ^~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:364:22: error: 'explicit' outside class declaration
364 | template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
| ^~~~~~~~
p1278.cpp:364:62: error: 'template<class Sseq> int mersenne_twister_engine(Sseq&)' redeclared as different kind of entity
364 | template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
| ^
p1278.cpp:315:10: note: previous declaration 'int mersenne_twister_engine'
315 | explicit mersenne_twister_engine(result_type value);
| ^~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:377:18: error: expected nested-name-specifier before 'result_type'
377 | using result_type = UIntType;
| ^~~~~~~~~~~
p1278.cpp:379:8: error: 'constexpr' does not name a type
379 | static constexpr size_t word_size = w;
| ^~~~~~~~~
p1278.cpp:379:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:380:8: error: 'constexpr' does not name a type
380 | static constexpr size_t short_lag = s;
| ^~~~~~~~~
p1278.cpp:380:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:381:8: error: 'constexpr' does not name a type
381 | static constexpr size_t long_lag = r;
| ^~~~~~~~~
p1278.cpp:381:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:382:8: error: 'constexpr' does not name a type
382 | static constexpr result_type min() { return 0; } static constexpr result_type max() { return m−1; } static constexpr result_type default_seed = 19780503u;
| ^~~~~~~~~
p1278.cpp:382:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:382:57: error: 'constexpr' does not name a type
382 | static constexpr result_type min() { return 0; } static constexpr result_type max() { return m−1; } static constexpr result_type default_seed = 19780503u;
| ^~~~~~~~~
p1278.cpp:382:57: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:382:108: error: 'constexpr' does not name a type
382 | sult_type min() { return 0; } static constexpr result_type max() { return m−1; } static constexpr result_type default_seed = 19780503u;
| ^~~~~~~~~
p1278.cpp:382:108: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:385:59: error: expected ')' before 'value'
385 | explicit subtract_with_carry_engine(result_type value);
| ~ ^~~~~~
| )
p1278.cpp:387:22: error: 'result_type' has not been declared
387 | void seed(result_type value = default_seed);
| ^~~~~~~~~~~
p1278.cpp:391:70: warning: friend declaration 'bool std::operator==(const subtract_with_carry_engine<UIntType, w, s, r>&, const subtract_with_carry_engine<UIntType, w, s, r>&)' declares a non-template function [-Wnon-template-friend]
391 | const subtract_with_carry_engine& y);
| ^
p1278.cpp:393:12: error: 'result_type' does not name a type
393 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:387:42: error: 'default_seed' was not declared in this scope
387 | void seed(result_type value = default_seed);
| ^~~~~~~~~~~~
p1278.cpp: In constructor 'std::subtract_with_carry_engine<UIntType, w, s, r>::subtract_with_carry_engine()':
p1278.cpp:384:70: error: 'default_seed' was not declared in this scope
384 | subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
| ^~~~~~~~~~~~
p1278.cpp:384:82: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
384 | subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {}
| ^
p1278.cpp: At global scope:
p1278.cpp:407:3: error: reference to 'linear_congruential_engine' is ambiguous
407 | linear_congruential_engine<result_type,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:34:13: note: candidates are: 'template<class UIntType, UIntType a, UIntType c, UIntType m> class std::linear_congruential_engine'
34 | class linear_congruential_engine;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:301:13: note: 'int linear_congruential_engine'
301 | explicit linear_congruential_engine(result_type s);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:411:13: error: ISO C++ forbids declaration of 'subtract_with_carry_engine' with no type [-fpermissive]
411 | explicit subtract_with_carry_engine(result_type value);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:411:4: error: 'explicit' outside class declaration
411 | explicit subtract_with_carry_engine(result_type value);
| ^~~~~~~~
p1278.cpp:411:40: error: 'result_type' was not declared in this scope
411 | explicit subtract_with_carry_engine(result_type value);
| ^~~~~~~~~~~
p1278.cpp:414:31: error: ISO C++ forbids declaration of 'subtract_with_carry_engine' with no type [-fpermissive]
414 | template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:414:22: error: 'explicit' outside class declaration
414 | template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
| ^~~~~~~~
p1278.cpp:414:65: error: 'template<class Sseq> int subtract_with_carry_engine(Sseq&)' redeclared as different kind of entity
414 | template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
| ^
p1278.cpp:411:13: note: previous declaration 'int subtract_with_carry_engine'
411 | explicit subtract_with_carry_engine(result_type value);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:433:16: error: expected nested-name-specifier before 'result_type'
433 | using result_type = typename Engine::result_type;
| ^~~~~~~~~~~
p1278.cpp:435:17: error: 'constexpr' does not name a type
435 | static constexpr size_t block_size = p;
| ^~~~~~~~~
p1278.cpp:435:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:436:17: error: 'constexpr' does not name a type
436 | static constexpr size_t used_block = r;
| ^~~~~~~~~
p1278.cpp:436:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:437:17: error: 'constexpr' does not name a type
437 | static constexpr result_type min() { return Engine::min(); }
| ^~~~~~~~~
p1278.cpp:437:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:438:17: error: 'constexpr' does not name a type
438 | static constexpr result_type max() { return Engine::max(); }
| ^~~~~~~~~
p1278.cpp:438:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:442:46: error: expected ',' or '...' before '&&' token
442 | explicit discard_block_engine(Engine&& e);
| ^~
p1278.cpp:443:51: error: expected ')' before 's'
443 | explicit discard_block_engine(result_type s);
| ~ ^~
| )
p1278.cpp:446:20: error: 'result_type' has not been declared
446 | void seed(result_type s);
| ^~~~~~~~~~~
p1278.cpp:449:93: warning: friend declaration 'bool std::operator==(const discard_block_engine<Engine, p, r>&, const discard_block_engine<Engine, p, r>&)' declares a non-template function [-Wnon-template-friend]
449 | friend bool operator==(const discard_block_engine& x, const discard_block_engine& y);
| ^
p1278.cpp:451:10: error: 'result_type' does not name a type
451 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:454:31: error: expected ';' at end of member declaration
454 | const Engine& base() const noexcept { return e; };
| ^~~~~
| ;
p1278.cpp:454:37: error: 'noexcept' does not name a type
454 | const Engine& base() const noexcept { return e; };
| ^~~~~~~~
p1278.cpp:454:37: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:477:1: error: 'S' does not name a type
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^
p1278.cpp:477:8: error: expected unqualified-id before 'for'
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^~~
p1278.cpp:477:16: error: 'k\U00000338' does not name a type
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^
p1278.cpp:477:21: error: 'k' does not name a type
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^
p1278.cpp:480:1: error: expected unqualified-id before 'for'
480 | for(k=n0;k̸=n;k+=1) {
| ^~~
p1278.cpp:480:10: error: 'k\U00000338' does not name a type
480 | for(k=n0;k̸=n;k+=1) {
| ^
p1278.cpp:480:14: error: 'k' does not name a type
480 | for(k=n0;k̸=n;k+=1) {
| ^
p1278.cpp:487:16: error: expected nested-name-specifier before 'result_type'
487 | using result_type = UIntType;
| ^~~~~~~~~~~
p1278.cpp:489:8: error: 'constexpr' does not name a type
489 | static constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^~~~~~~~~
p1278.cpp:489:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:489:57: error: 'constexpr' does not name a type
489 | static constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^~~~~~~~~
p1278.cpp:489:57: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:493:49: error: expected ',' or '...' before '&&' token
493 | explicit independent_bits_engine(Engine&& e);
| ^~
p1278.cpp:494:54: error: expected ')' before 's'
494 | explicit independent_bits_engine(result_type s);
| ~ ^~
| )
p1278.cpp:497:20: error: 'result_type' has not been declared
497 | void seed(result_type s);
| ^~~~~~~~~~~
p1278.cpp:500:99: warning: friend declaration 'bool operator==(const independent_bits_engine<Engine, w, UIntType>&, const independent_bits_engine<Engine, w, UIntType>&)' declares a non-template function [-Wnon-template-friend]
500 | friend bool operator==(const independent_bits_engine& x, const independent_bits_engine& y);
| ^
p1278.cpp:502:10: error: 'result_type' does not name a type
502 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:505:31: error: expected ';' at end of member declaration
505 | const Engine& base() const noexcept { return e; };
| ^~~~~
| ;
p1278.cpp:505:37: error: 'noexcept' does not name a type
505 | const Engine& base() const noexcept { return e; };
| ^~~~~~~~
p1278.cpp:505:37: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:529:16: error: expected nested-name-specifier before 'result_type'
529 | using result_type = typename Engine::result_type;
| ^~~~~~~~~~~
p1278.cpp:531:17: error: 'constexpr' does not name a type
531 | static constexpr size_t table_size = k;
| ^~~~~~~~~
p1278.cpp:531:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:532:17: error: 'constexpr' does not name a type
532 | static constexpr result_type min() { return Engine::min(); }
| ^~~~~~~~~
p1278.cpp:532:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:533:17: error: 'constexpr' does not name a type
533 | static constexpr result_type max() { return Engine::max(); }
| ^~~~~~~~~
p1278.cpp:533:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:537:46: error: expected ',' or '...' before '&&' token
537 | explicit shuffle_order_engine(Engine&& e);
| ^~
p1278.cpp:538:51: error: expected ')' before 's'
538 | explicit shuffle_order_engine(result_type s);
| ~ ^~
| )
p1278.cpp:541:20: error: 'result_type' has not been declared
541 | void seed(result_type s);
| ^~~~~~~~~~~
p1278.cpp:544:93: warning: friend declaration 'bool std::operator==(const shuffle_order_engine<Engine, k>&, const shuffle_order_engine<Engine, k>&)' declares a non-template function [-Wnon-template-friend]
544 | friend bool operator==(const shuffle_order_engine& x, const shuffle_order_engine& y);
| ^
p1278.cpp:546:10: error: 'result_type' does not name a type
546 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:549:31: error: expected ';' at end of member declaration
549 | const Engine& base() const noexcept { return e; };
| ^~~~~
| ;
p1278.cpp:549:37: error: 'noexcept' does not name a type
549 | const Engine& base() const noexcept { return e; };
| ^~~~~~~~
p1278.cpp:549:37: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:559:5: error: 'result_type' does not name a type
559 | result_type V[k];
| ^~~~~~~~~~~
p1278.cpp:560:5: error: 'result_type' does not name a type
560 | result_type Y;
| ^~~~~~~~~~~
p1278.cpp:567:10: error: expected nested-name-specifier before 'minstd_rand0'
567 | using minstd_rand0 =
| ^~~~~~~~~~~~
p1278.cpp:575:7: error: expected nested-name-specifier before 'minstd_rand'
575 | using minstd_rand =
| ^~~~~~~~~~~
p1278.cpp:578:7: error: expected nested-name-specifier before 'mt19937'
578 | using mt19937 =
| ^~~~~~~
p1278.cpp:581:7: error: expected nested-name-specifier before 'mt19937_64'
581 | using mt19937_64 =
| ^~~~~~~~~~
p1278.cpp:585:7: error: expected nested-name-specifier before 'ranlux24_base'
585 | using ranlux24_base =
| ^~~~~~~~~~~~~
p1278.cpp:588:7: error: expected nested-name-specifier before 'ranlux48_base'
588 | using ranlux48_base =
| ^~~~~~~~~~~~~
p1278.cpp:591:7: error: expected nested-name-specifier before 'ranlux24'
591 | using ranlux24 = discard_block_engine<ranlux24_base, 223, 23>;
| ^~~~~~~~
p1278.cpp:593:7: error: expected nested-name-specifier before 'ranlux48'
593 | using ranlux48 = discard_block_engine<ranlux48_base, 389, 11>;
| ^~~~~~~~
p1278.cpp:595:7: error: expected nested-name-specifier before 'knuth_b'
595 | using knuth_b = shuffle_order_engine<minstd_rand0,256>;
| ^~~~~~~
p1278.cpp:597:7: error: expected nested-name-specifier before 'default_random_engine'
597 | using default_random_engine = implementation-defined;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:604:13: error: expected nested-name-specifier before 'result_type'
604 | using result_type = unsigned int;
| ^~~~~~~~~~~
p1278.cpp:606:14: error: 'constexpr' does not name a type
606 | static constexpr result_type min() { return numeric_limits<result_type>::min(); }
| ^~~~~~~~~
p1278.cpp:606:14: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:607:14: error: 'constexpr' does not name a type
607 | static constexpr result_type max() { return numeric_limits<result_type>::max(); }
| ^~~~~~~~~
p1278.cpp:607:14: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:611:7: error: 'result_type' does not name a type
611 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:613:24: error: expected ';' at end of member declaration
613 | double entropy() const noexcept;
| ^~~~~
| ;
p1278.cpp:613:30: error: 'noexcept' does not name a type
613 | double entropy() const noexcept;
| ^~~~~~~~
p1278.cpp:613:30: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:615:45: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++1' [-Wc++11-extensions]
615 | random_device(const random_device&) = delete;
| ^~~~~~
p1278.cpp:616:46: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++1' [-Wc++11-extensions]
616 | void operator=(const random_device&) = delete;
| ^~~~~~
p1278.cpp: In constructor 'std::random_device::random_device()':
p1278.cpp:609:33: error: 'implementation' was not declared in this scope
609 | random_device() : random_device(implementation-defined) {} explicit random_device(const string& token);
| ^~~~~~~~~~~~~~
p1278.cpp:609:48: error: 'defined' was not declared in this scope
609 | random_device() : random_device(implementation-defined) {} explicit random_device(const string& token);
| ^~~~~~~
p1278.cpp:609:55: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
609 | random_device() : random_device(implementation-defined) {} explicit random_device(const string& token);
| ^
p1278.cpp: At global scope:
p1278.cpp:619:24: error: expected unqualified-id before 'const'
619 | explicit random_device(const string& token);
| ^~~~~
p1278.cpp:619:24: error: expected ')' before 'const'
619 | explicit random_device(const string& token);
| ~^~~~~
| )
p1278.cpp:620:24: error: expected initializer before 'noexcept'
620 | double entropy() const noexcept;
| ^~~~~~~~
p1278.cpp:622:1: error: 'result_type' does not name a type
622 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:631:13: error: expected nested-name-specifier before 'result_type'
631 | using result_type = uint_least32_t;
| ^~~~~~~~~~~
p1278.cpp:633:16: error: expected ';' at end of member declaration
633 | seed_seq() noexcept;
| ^
| ;
p1278.cpp:633:18: error: 'noexcept' does not name a type
633 | seed_seq() noexcept;
| ^~~~~~~~
p1278.cpp:633:18: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:635:34: error: expected ')' before '<' token
635 | seed_seq(initializer_list<T> il);
| ~ ^
| )
p1278.cpp:644:15: error: expected ';' at end of member declaration
644 | size_t size() const noexcept;
| ^~~~~
| ;
p1278.cpp:644:21: error: 'noexcept' does not name a type
644 | size_t size() const noexcept;
| ^~~~~~~~
p1278.cpp:644:21: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1278.cpp:648:29: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++1' [-Wc++11-extensions]
648 | seed_seq(const seed_seq&) = delete;
| ^~~~~~
p1278.cpp:649:35: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++1' [-Wc++11-extensions]
649 | void operator=(const seed_seq&) = delete;
| ^~~~~~
p1278.cpp:651:14: error: 'result_type' was not declared in this scope
651 | vector<result_type> v;
| ^~~~~~~~~~~
p1278.cpp:651:25: error: template argument 1 is invalid
651 | vector<result_type> v;
| ^
p1278.cpp:651:25: error: template argument 2 is invalid
p1278.cpp:653:10: error: expected unqualified-id before ')' token
653 | seed_seq() noexcept;
| ^
p1278.cpp:655:26: error: expected ')' before '<' token
655 | seed_seq(initializer_list<T> il);
| ~ ^
| )
p1278.cpp:659:25: error: expected ')' before 'begin'
659 | seed_seq(InputIterator begin, InputIterator end);
| ~ ^~~~~~
| )
p1278.cpp:661:1: error: expected unqualified-id before 'for'
661 | for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
| ^~~
p1278.cpp:661:31: error: 's' does not name a type
661 | for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
| ^
p1278.cpp:661:41: error: expected unqualified-id before '++' token
661 | for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
| ^~
p1278.cpp:668:1: error: 't' does not name a type; did you mean 'tm'?
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
| tm
p1278.cpp:676:21: error: expected initializer before 'noexcept'
676 | size_t size() const noexcept;
| ^~~~~~~~
p1278.cpp:679:35: error: non-member function 'void param(OutputIterator)' cannot have cv-qualifier
679 | void param(OutputIterator dest) const;
| ^~~~~
p1278.cpp:683:7: error: expected constructor, destructor, or type conversion before '(' token
683 | copy(v.begin(), v.end(), dest);
| ^
p1278.cpp:700:12: error: redefinition of default argument for 'class IntType'
700 | template<class IntType = int>
| ^~~~~
p1278.cpp:71:10: note: original definition appeared here
71 | template<class IntType = int>
| ^~~~~
p1278.cpp:732:10: error: ISO C++ forbids declaration of 'uniform_int_distribution' with no type [-fpermissive]
732 | explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:732:1: error: 'explicit' outside class declaration
732 | explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
| ^~~~~~~~
p1278.cpp:732:35: error: 'IntType' was not declared in this scope
732 | explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
| ^~~~~~~
p1278.cpp:732:46: error: 'IntType' was not declared in this scope
732 | explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
| ^~~~~~~
p1278.cpp:732:88: error: expression list treated as compound expression in initializer [-fpermissive]
732 | explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
| ^
p1278.cpp:736:1: error: 'result_type' does not name a type
736 | result_type a() const;
| ^~~~~~~~~~~
p1278.cpp:743:14: error: redefinition of default argument for 'class RealType'
743 | template<class RealType = double>
| ^~~~~
p1278.cpp:74:10: note: original definition appeared here
74 | template<class RealType = double>
| ^~~~~
p1278.cpp:776:10: error: ISO C++ forbids declaration of 'uniform_real_distribution' with no type [-fpermissive]
776 | explicit uniform_real_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:776:1: error: 'explicit' outside class declaration
776 | explicit uniform_real_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:776:36: error: 'RealType' was not declared in this scope
776 | explicit uniform_real_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:776:48: error: 'RealType' was not declared in this scope
776 | explicit uniform_real_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:776:64: error: expression list treated as compound expression in initializer [-fpermissive]
776 | explicit uniform_real_distribution(RealType a, RealType b = 1.0);
| ^
p1278.cpp:788:7: error: expected nested-name-specifier before 'result_type'
788 | using result_type = bool;
| ^~~~~~~~~~~
p1278.cpp:789:7: error: expected nested-name-specifier before 'param_type'
789 | using param_type = unspecified ;
| ^~~~~~~~~~
p1278.cpp:793:45: error: 'param_type' does not name a type
793 | explicit bernoulli_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:799:9: error: 'result_type' does not name a type
799 | result_type operator()(URBG& g);
| ^~~~~~~~~~~
p1278.cpp:801:9: error: 'result_type' does not name a type
801 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~~
p1278.cpp:804:7: error: 'param_type' does not name a type
804 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:805:24: error: 'param_type' does not name a type
805 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:806:7: error: 'result_type' does not name a type
806 | result_type min() const;
| ^~~~~~~~~~~
p1278.cpp:807:7: error: 'result_type' does not name a type
807 | result_type max() const;
| ^~~~~~~~~~~
p1278.cpp: In constructor 'std::bernoulli_distribution::bernoulli_distribution()':
p1278.cpp:791:60: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
791 | bernoulli_distribution() : bernoulli_distribution(0.5) {}
| ^
p1278.cpp: At global scope:
p1278.cpp:816:33: error: expected unqualified-id before 'double'
816 | explicit bernoulli_distribution(double p);
| ^~~~~~
p1278.cpp:816:33: error: expected ')' before 'double'
816 | explicit bernoulli_distribution(double p);
| ~^~~~~~
| )
p1278.cpp:820:12: error: non-member function 'double p()' cannot have cv-qualifier
820 | double p() const;
| ^~~~~
p1278.cpp:824:12: error: redefinition of default argument for 'class IntType'
824 | template<class IntType = int>
| ^~~~~
p1278.cpp:79:10: note: original definition appeared here
79 | template<class IntType = int>
| ^~~~~
p1278.cpp:857:10: error: ISO C++ forbids declaration of 'binomial_distribution' with no type [-fpermissive]
857 | explicit binomial_distribution(IntType t, double p = 0.5);
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:857:1: error: 'explicit' outside class declaration
857 | explicit binomial_distribution(IntType t, double p = 0.5);
| ^~~~~~~~
p1278.cpp:857:32: error: 'IntType' was not declared in this scope
857 | explicit binomial_distribution(IntType t, double p = 0.5);
| ^~~~~~~
p1278.cpp:857:43: error: expected primary-expression before 'double'
857 | explicit binomial_distribution(IntType t, double p = 0.5);
| ^~~~~~
p1278.cpp:857:57: error: expression list treated as compound expression in initializer [-fpermissive]
857 | explicit binomial_distribution(IntType t, double p = 0.5);
| ^
p1278.cpp:861:1: error: 'IntType' does not name a type
861 | IntType t() const;
| ^~~~~~~
p1278.cpp:866:12: error: redefinition of default argument for 'class IntType'
866 | template<class IntType = int>
| ^~~~~
p1278.cpp:82:10: note: original definition appeared here
82 | template<class IntType = int>
| ^~~~~
p1278.cpp:898:13: error: ISO C++ forbids declaration of 'geometric_distribution' with no type [-fpermissive]
898 | explicit geometric_distribution(double p);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:898:4: error: 'explicit' outside class declaration
898 | explicit geometric_distribution(double p);
| ^~~~~~~~
p1278.cpp:902:17: error: redefinition of default argument for 'class IntType'
902 | template<class IntType = int>
| ^~~~~
p1278.cpp:85:10: note: original definition appeared here
85 | template<class IntType = int>
| ^~~~~
p1278.cpp:940:10: error: ISO C++ forbids declaration of 'negative_binomial_distribution' with no type [-fpermissive]
940 | explicit negative_binomial_distribution(IntType k, double p = 0.5);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:940:1: error: 'explicit' outside class declaration
940 | explicit negative_binomial_distribution(IntType k, double p = 0.5);
| ^~~~~~~~
p1278.cpp:940:41: error: 'IntType' was not declared in this scope
940 | explicit negative_binomial_distribution(IntType k, double p = 0.5);
| ^~~~~~~
p1278.cpp:940:52: error: expected primary-expression before 'double'
940 | explicit negative_binomial_distribution(IntType k, double p = 0.5);
| ^~~~~~
p1278.cpp:940:66: error: expression list treated as compound expression in initializer [-fpermissive]
940 | explicit negative_binomial_distribution(IntType k, double p = 0.5);
| ^
p1278.cpp:949:7: error: expected nested-name-specifier before 'result_type'
949 | using result_type = IntType; using param_type = unspecified ;
| ^~~~~~~~~~~
p1278.cpp:949:36: error: expected nested-name-specifier before 'param_type'
949 | using result_type = IntType; using param_type = unspecified ;
| ^~~~~~~~~~
p1278.cpp:953:46: error: 'param_type' does not name a type
953 | explicit poisson_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:956:93: warning: friend declaration 'bool operator==(const poisson_distribution<IntType>&, const poisson_distribution<IntType>&)' declares a non-template function [-Wnon-template-friend]
956 | friend bool operator==(const poisson_distribution& x, const poisson_distribution& y);
| ^
p1278.cpp:959:12: error: 'result_type' does not name a type
959 | result_type operator()(URBG& g);
| ^~~~~~~~~~~
p1278.cpp:961:12: error: 'result_type' does not name a type
961 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~~
p1278.cpp:968:7: error: 'param_type' does not name a type
968 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:969:24: error: 'param_type' does not name a type
969 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:970:7: error: 'result_type' does not name a type
970 | result_type min() const;
| ^~~~~~~~~~~
p1278.cpp:971:7: error: 'result_type' does not name a type
971 | result_type max() const;
| ^~~~~~~~~~~
p1278.cpp: In constructor 'poisson_distribution<IntType>::poisson_distribution()':
p1278.cpp:951:59: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
951 | poisson_distribution() : poisson_distribution(1.0) {}
| ^
p1278.cpp: At global scope:
p1278.cpp:980:10: error: ISO C++ forbids declaration of 'poisson_distribution' with no type [-fpermissive]
980 | explicit poisson_distribution(double mean);
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:980:1: error: 'explicit' outside class declaration
980 | explicit poisson_distribution(double mean);
| ^~~~~~~~
p1278.cpp:980:42: error: 'int poisson_distribution(double)' redeclared as different kind of entity
980 | explicit poisson_distribution(double mean);
| ^
p1278.cpp:945:14: note: previous declaration 'template<class IntType> class poisson_distribution'
945 | class poisson_distribution
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:984:15: error: non-member function 'double mean()' cannot have cv-qualifier
984 | double mean() const;
| ^~~~~
p1278.cpp:988:12: error: redefinition of default argument for 'class RealType'
988 | template<class RealType = double>
| ^~~~~
p1278.cpp:91:10: note: original definition appeared here
91 | template<class RealType = double>
| ^~~~~
p1278.cpp:1020:10: error: ISO C++ forbids declaration of 'exponential_distribution' with no type [-fpermissive]
1020 | explicit exponential_distribution(RealType lambda);
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1020:1: error: 'explicit' outside class declaration
1020 | explicit exponential_distribution(RealType lambda);
| ^~~~~~~~
p1278.cpp:1020:35: error: 'RealType' was not declared in this scope
1020 | explicit exponential_distribution(RealType lambda);
| ^~~~~~~~
p1278.cpp:1025:17: error: redefinition of default argument for 'class RealType'
1025 | template<class RealType = double>
| ^~~~~
p1278.cpp:94:10: note: original definition appeared here
94 | template<class RealType = double>
| ^~~~~
p1278.cpp:1057:1: error: 'RealType' does not name a type
1057 | RealType lambda() const;
| ^~~~~~~~
p1278.cpp:1060:13: error: ISO C++ forbids declaration of 'gamma_distribution' with no type [-fpermissive]
1060 | explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
| ^~~~~~~~~~~~~~~~~~
p1278.cpp:1060:4: error: 'explicit' outside class declaration
1060 | explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
| ^~~~~~~~
p1278.cpp:1060:32: error: 'RealType' was not declared in this scope
1060 | explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
| ^~~~~~~~
p1278.cpp:1060:48: error: 'RealType' was not declared in this scope
1060 | explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
| ^~~~~~~~
p1278.cpp:1060:67: error: expression list treated as compound expression in initializer [-fpermissive]
1060 | explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
| ^
p1278.cpp:1064:1: error: 'RealType' does not name a type
1064 | RealType alpha() const;
| ^~~~~~~~
p1278.cpp:1073:7: error: expected nested-name-specifier before 'result_type'
1073 | using result_type = RealType; using param_type = unspecified ;
| ^~~~~~~~~~~
p1278.cpp:1073:37: error: expected nested-name-specifier before 'param_type'
1073 | using result_type = RealType; using param_type = unspecified ;
| ^~~~~~~~~~
p1278.cpp:1079:43: error: 'param_type' does not name a type
1079 | explicit weibull_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1082:90: warning: friend declaration 'bool std::operator==(const weibull_distribution<RealType>&, const weibull_distribution<RealType>&)' declares a non-template function [-Wnon-template-friend]
1082 | friend bool operator==(const weibull_distribution& x, const weibull_distribution& y);
| ^
p1278.cpp:1085:9: error: 'result_type' does not name a type
1085 | result_type operator()(URBG& g);
| ^~~~~~~~~~~
p1278.cpp:1087:9: error: 'result_type' does not name a type
1087 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~~
p1278.cpp:1091:7: error: 'param_type' does not name a type
1091 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:1092:24: error: 'param_type' does not name a type
1092 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1093:7: error: 'result_type' does not name a type
1093 | result_type min() const;
| ^~~~~~~~~~~
p1278.cpp:1094:7: error: 'result_type' does not name a type
1094 | result_type max() const;
| ^~~~~~~~~~~
p1278.cpp: In constructor 'std::weibull_distribution<RealType>::weibull_distribution()':
p1278.cpp:1077:56: warning: delegating constructors only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
1077 | weibull_distribution() : weibull_distribution(1.0) {}
| ^
p1278.cpp: At global scope:
p1278.cpp:1103:10: error: ISO C++ forbids declaration of 'weibull_distribution' with no type [-fpermissive]
1103 | explicit weibull_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:1103:1: error: 'explicit' outside class declaration
1103 | explicit weibull_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1103:31: error: 'RealType' was not declared in this scope
1103 | explicit weibull_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1103:43: error: 'RealType' was not declared in this scope
1103 | explicit weibull_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1103:59: error: expression list treated as compound expression in initializer [-fpermissive]
1103 | explicit weibull_distribution(RealType a, RealType b = 1.0);
| ^
p1278.cpp:1104:4: error: 'RealType' does not name a type
1104 | RealType a() const;
| ^~~~~~~~
p1278.cpp:1110:12: error: redefinition of default argument for 'class RealType'
1110 | template<class RealType = double>
| ^~~~~
p1278.cpp:100:10: note: original definition appeared here
100 | template<class RealType = double>
| ^~~~~
p1278.cpp:1146:10: error: ISO C++ forbids declaration of 'extreme_value_distribution' with no type [-fpermissive]
1146 | explicit extreme_value_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1146:1: error: 'explicit' outside class declaration
1146 | explicit extreme_value_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1146:37: error: 'RealType' was not declared in this scope
1146 | explicit extreme_value_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1146:49: error: 'RealType' was not declared in this scope
1146 | explicit extreme_value_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1146:65: error: expression list treated as compound expression in initializer [-fpermissive]
1146 | explicit extreme_value_distribution(RealType a, RealType b = 1.0);
| ^
p1278.cpp:1147:1: error: 'RealType' does not name a type
1147 | RealType a() const;
| ^~~~~~~~
p1278.cpp:1152:17: error: redefinition of default argument for 'class RealType'
1152 | template<class RealType = double>
| ^~~~~
p1278.cpp:103:10: note: original definition appeared here
103 | template<class RealType = double>
| ^~~~~
p1278.cpp:1184:13: error: ISO C++ forbids declaration of 'normal_distribution' with no type [-fpermissive]
1184 | explicit normal_distribution(RealType mean, RealType stddev = 1.0);
| ^~~~~~~~~~~~~~~~~~~
p1278.cpp:1184:4: error: 'explicit' outside class declaration
1184 | explicit normal_distribution(RealType mean, RealType stddev = 1.0);
| ^~~~~~~~
p1278.cpp:1184:33: error: 'RealType' was not declared in this scope
1184 | explicit normal_distribution(RealType mean, RealType stddev = 1.0);
| ^~~~~~~~
p1278.cpp:1184:48: error: 'RealType' was not declared in this scope
1184 | explicit normal_distribution(RealType mean, RealType stddev = 1.0);
| ^~~~~~~~
p1278.cpp:1184:69: error: expression list treated as compound expression in initializer [-fpermissive]
1184 | explicit normal_distribution(RealType mean, RealType stddev = 1.0);
| ^
p1278.cpp:1190:1: error: 'RealType' does not name a type
1190 | RealType mean() const;
| ^~~~~~~~
p1278.cpp:1192:4: error: 'RealType' does not name a type
1192 | RealType stddev() const;
| ^~~~~~~~
p1278.cpp:1198:12: error: redefinition of default argument for 'class RealType'
1198 | template<class RealType = double>
| ^~~~~
p1278.cpp:106:10: note: original definition appeared here
106 | template<class RealType = double>
| ^~~~~
p1278.cpp:1232:10: error: ISO C++ forbids declaration of 'lognormal_distribution' with no type [-fpermissiv]
1232 | explicit lognormal_distribution(RealType m, RealType s = 1.0);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1232:1: error: 'explicit' outside class declaration
1232 | explicit lognormal_distribution(RealType m, RealType s = 1.0);
| ^~~~~~~~
p1278.cpp:1232:33: error: 'RealType' was not declared in this scope
1232 | explicit lognormal_distribution(RealType m, RealType s = 1.0);
| ^~~~~~~~
p1278.cpp:1232:45: error: 'RealType' was not declared in this scope
1232 | explicit lognormal_distribution(RealType m, RealType s = 1.0);
| ^~~~~~~~
p1278.cpp:1232:61: error: expression list treated as compound expression in initializer [-fpermissive]
1232 | explicit lognormal_distribution(RealType m, RealType s = 1.0);
| ^
p1278.cpp:1233:1: error: 'RealType' does not name a type
1233 | RealType m() const;
| ^~~~~~~~
p1278.cpp:1239:14: error: redefinition of default argument for 'class RealType'
1239 | template<class RealType = double>
| ^~~~~
p1278.cpp:109:10: note: original definition appeared here
109 | template<class RealType = double>
| ^~~~~
p1278.cpp:1270:10: error: ISO C++ forbids declaration of 'chi_squared_distribution' with no type [-fpermissive]
1270 | explicit chi_squared_distribution(RealType n);
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1270:1: error: 'explicit' outside class declaration
1270 | explicit chi_squared_distribution(RealType n);
| ^~~~~~~~
p1278.cpp:1270:35: error: 'RealType' was not declared in this scope
1270 | explicit chi_squared_distribution(RealType n);
| ^~~~~~~~
p1278.cpp:1274:1: error: 'RealType' does not name a type
1274 | RealType n() const;
| ^~~~~~~~
p1278.cpp:1278:14: error: redefinition of default argument for 'class RealType'
1278 | template<class RealType = double>
| ^~~~~
p1278.cpp:112:10: note: original definition appeared here
112 | template<class RealType = double> class cauchy_distribution;
| ^~~~~
p1278.cpp:1310:10: error: ISO C++ forbids declaration of 'cauchy_distribution' with no type [-fpermissive]
1310 | explicit cauchy_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~
p1278.cpp:1310:1: error: 'explicit' outside class declaration
1310 | explicit cauchy_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1310:30: error: 'RealType' was not declared in this scope
1310 | explicit cauchy_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1310:42: error: 'RealType' was not declared in this scope
1310 | explicit cauchy_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~
p1278.cpp:1310:58: error: expression list treated as compound expression in initializer [-fpermissive]
1310 | explicit cauchy_distribution(RealType a, RealType b = 1.0);
| ^
p1278.cpp:1314:1: error: 'RealType' does not name a type
1314 | RealType a() const;
| ^~~~~~~~
p1278.cpp:1321:14: error: redefinition of default argument for 'class RealType'
1321 | template<class RealType = double>
| ^~~~~
p1278.cpp:123:10: note: original definition appeared here
123 | template<class RealType = double>
| ^~~~~
p1278.cpp:1353:10: error: ISO C++ forbids declaration of 'fisher_f_distribution' with no type [-fpermissive]
1353 | explicit fisher_f_distribution(RealType m, RealType n = 1);
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1353:1: error: 'explicit' outside class declaration
1353 | explicit fisher_f_distribution(RealType m, RealType n = 1);
| ^~~~~~~~
p1278.cpp:1353:32: error: 'RealType' was not declared in this scope
1353 | explicit fisher_f_distribution(RealType m, RealType n = 1);
| ^~~~~~~~
p1278.cpp:1353:44: error: 'RealType' was not declared in this scope
1353 | explicit fisher_f_distribution(RealType m, RealType n = 1);
| ^~~~~~~~
p1278.cpp:1353:58: error: expression list treated as compound expression in initializer [-fpermissive]
1353 | explicit fisher_f_distribution(RealType m, RealType n = 1);
| ^
p1278.cpp:1358:1: error: 'RealType' does not name a type
1358 | RealType m() const;
| ^~~~~~~~
p1278.cpp:1363:14: error: redefinition of default argument for 'class RealType'
1363 | template<class RealType = double>
| ^~~~~
p1278.cpp:126:10: note: original definition appeared here
126 | template<class RealType = double>
| ^~~~~
p1278.cpp:1394:10: error: ISO C++ forbids declaration of 'student_t_distribution' with no type [-fpermissiv]
1394 | explicit student_t_distribution(RealType n);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1394:1: error: 'explicit' outside class declaration
1394 | explicit student_t_distribution(RealType n);
| ^~~~~~~~
p1278.cpp:1394:33: error: 'RealType' was not declared in this scope
1394 | explicit student_t_distribution(RealType n);
| ^~~~~~~~
p1278.cpp:1400:17: error: redefinition of default argument for 'class IntType'
1400 | template<class IntType = int>
| ^~~~~
p1278.cpp:129:10: note: original definition appeared here
129 | template<class IntType = int>
| ^~~~~
p1278.cpp:1438:24: error: expected constructor, destructor, or type conversion before ';' token
1438 | discrete_distribution();
| ^
p1278.cpp:1441:67: error: expected constructor, destructor, or type conversion before ';' token
1441 | discrete_distribution(InputIterator firstW, InputIterator lastW);
| ^
p1278.cpp:1444:22: error: expected constructor, destructor, or type conversion before '(' token
1444 | discrete_distribution(initializer_list<double> wl);
| ^
p1278.cpp:1446:60: error: 'UnaryOperation' has not been declared
1446 | discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
| ^~~~~~~~~~~~~~
p1278.cpp:1446:78: error: expected constructor, destructor, or type conversion before ';' token
1446 | discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
| ^
p1278.cpp:1457:11: error: 'std::piecewise_constant_distribution' is not a template
1457 | class piecewise_constant_distribution {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:132:16: note: previous declaration here
132 | class piecewise_constant_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1497:38: error: expected unqualified-id before ')' token
1497 | piecewise_constant_distribution();
| ^
p1278.cpp:1500:48: error: expected ')' before 'firstB'
1500 | piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB,
| ~ ^~~~~~~
| )
p1278.cpp:1507:50: error: expected ')' before '<' token
1507 | piecewise_constant_distribution(initializer_list<RealType> bl, UnaryOperation fw);
| ~ ^
| )
p1278.cpp:1511:40: error: expected ')' before 'nw'
1511 | piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ~ ^~~
| )
p1278.cpp:1517:8: error: 'result_type' was not declared in this scope
1517 | vector<result_type> densities() const;
| ^~~~~~~~~~~
p1278.cpp:1517:19: error: template argument 1 is invalid
1517 | vector<result_type> densities() const;
| ^
p1278.cpp:1517:19: error: template argument 2 is invalid
p1278.cpp:1517:33: error: non-member function 'int densities()' cannot have cv-qualifier
1517 | vector<result_type> densities() const;
| ^~~~~
p1278.cpp:1523:41: error: expected constructor, destructor, or type conversion before ';' token
1523 | piecewise_linear_distribution();
| ^
p1278.cpp:1526:64: error: expected constructor, destructor, or type conversion before ';' token
1526 | InputIteratorW firstW);
| ^
p1278.cpp:1528:41: error: expected constructor, destructor, or type conversion before '(' token
1528 | piecewise_linear_distribution(initializer_list<RealType> bl, UnaryOperation fw);
| ^
p1278.cpp:1530:53: error: 'RealType' has not been declared
1530 | piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ^~~~~~~~
p1278.cpp:1530:68: error: 'RealType' has not been declared
1530 | piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ^~~~~~~~
p1278.cpp:1530:101: error: expected constructor, destructor, or type conversion before ';' token
1530 | piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ^
p1278.cpp:1531:55: error: 'param_type' does not name a type
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1531:19: error: ISO C++ forbids declaration of 'piecewise_linear_distribution' with no type [-fpermissive]
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1531:10: error: 'explicit' outside class declaration
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~
p1278.cpp:1534:10: error: 'friend' used outside of class
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ^~~~~~
| ------
p1278.cpp:1534:39: error: reference to 'piecewise_linear_distribution' is ambiguous
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: candidates are: 'template<class RealType> class std::piecewise_linear_distribution'
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1531:19: note: 'int piecewise_linear_distribution(const int&)'
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1535:39: error: reference to 'piecewise_linear_distribution' is ambiguous
1535 | const piecewise_linear_distribution& y);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: candidates are: 'template<class RealType> class std::piecewise_linear_distribution'
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1531:19: note: 'int piecewise_linear_distribution(const int&)'
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1534:22: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ^~~~~~~~
p1278.cpp:1538:12: error: 'result_type' does not name a type
1538 | result_type operator()(URBG& g);
| ^~~~~~~~~~~
p1278.cpp:1540:12: error: 'result_type' does not name a type
1540 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~~
p1278.cpp:1542:17: error: 'result_type' was not declared in this scope
1542 | vector<result_type> intervals() const;
| ^~~~~~~~~~~
p1278.cpp:1542:28: error: template argument 1 is invalid
1542 | vector<result_type> intervals() const;
| ^
p1278.cpp:1542:28: error: template argument 2 is invalid
p1278.cpp:1542:42: error: non-member function 'int intervals()' cannot have cv-qualifier
1542 | vector<result_type> intervals() const;
| ^~~~~
p1278.cpp:1543:17: error: 'result_type' was not declared in this scope
1543 | vector<result_type> densities() const;
| ^~~~~~~~~~~
p1278.cpp:1543:28: error: template argument 1 is invalid
1543 | vector<result_type> densities() const;
| ^
p1278.cpp:1543:28: error: template argument 2 is invalid
p1278.cpp:1543:42: error: non-member function 'int densities()' cannot have cv-qualifier
1543 | vector<result_type> densities() const;
| ^~~~~
p1278.cpp:1544:10: error: 'param_type' does not name a type
1544 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:1545:27: error: 'param_type' does not name a type
1545 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1546:10: error: 'result_type' does not name a type
1546 | result_type min() const;
| ^~~~~~~~~~~
p1278.cpp:1547:10: error: 'result_type' does not name a type
1547 | result_type max() const;
| ^~~~~~~~~~~
p1278.cpp:1550:12: error: 'friend' used outside of class
1550 | friend basic_ostream<charT, traits>&
| ^~~~~~
| ------
p1278.cpp:1551:65: error: reference to 'piecewise_linear_distribution' is ambiguous
1551 | operator<<(basic_ostream<charT, traits>& os, const piecewise_linear_distribution& x);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: candidates are: 'template<class RealType> class std::piecewise_linear_distribution'
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1531:19: note: 'int piecewise_linear_distribution(const int&)'
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1553:12: error: 'friend' used outside of class
1553 | friend basic_istream<charT, traits>&
| ^~~~~~
| ------
p1278.cpp:1554:59: error: reference to 'piecewise_linear_distribution' is ambiguous
1554 | operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: candidates are: 'template<class RealType> class std::piecewise_linear_distribution'
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1531:19: note: 'int piecewise_linear_distribution(const int&)'
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1554:59: error: 'piecewise_linear_distribution' has not been declared
1554 | operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1555:1: error: expected declaration before '}' token
1555 | }; }
| ^
p1278.cpp:1555:4: error: expected declaration before '}' token
1555 | }; }
| ^
p1278.cpp:1556:35: error: expected constructor, destructor, or type conversion before ';' token
1556 | piecewise_linear_distribution();
| ^
p1278.cpp:1558:12: error: redefinition of default argument for 'class RealType'
1558 | template<class RealType = double>
| ^~~~~
p1278.cpp:134:10: note: original definition appeared here
134 | template<class RealType = double>
| ^~~~~
$ g++ p1278.cpp -std=2b -o p1278g -I. -Wall
p1278.cpp:341:48: error: extended character − is not valid in an identifier
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^
p1278.cpp:382:94: error: extended character − is not valid in an identifier
382 | c constexpr result_type min() { return 0; } static constexpr result_type max() { return m−1; } static constexpr result_type default_seed = 19780503u;
| ^
p1278.cpp:478:32: error: extended character ≥ is not valid in an identifier
478 | do u = e() - e.min(); while (u ≥ y0);
| ^
p1278.cpp:481:32: error: extended character ≥ is not valid in an identifier
481 | do u = e() - e.min(); while (u ≥ y1); S = 2w0+1 ·S+umod2w0+1;
| ^
p1278.cpp:489:97: error: extended character − is not valid in an identifier
489 | tic constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^
p1278.cpp:568:44: error: extended character ’ is not valid in an identifier
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^
p1278.cpp:568:55: error: extended character ’ is not valid in an identifier
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^
p1278.cpp:568:55: error: extended character ’ is not valid in an identifier
p1278.cpp:568:55: error: extended character ’ is not valid in an identifier
p1278.cpp:576:49: error: extended character ’ is not valid in an identifier
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^
p1278.cpp:576:60: error: extended character ’ is not valid in an identifier
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^
p1278.cpp:576:60: error: extended character ’ is not valid in an identifier
p1278.cpp:576:60: error: extended character ’ is not valid in an identifier
p1278.cpp:579:64: error: extended character ’ is not valid in an identifier
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:81: error: extended character ’ is not valid in an identifier
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:97: error: extended character ’ is not valid in an identifier
579 | rsenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:114: error: extended character ’ is not valid in an identifier
579 | gine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:131: error: extended character ’ is not valid in an identifier
579 | t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:131: error: extended character ’ is not valid in an identifier
p1278.cpp:579:131: error: extended character ’ is not valid in an identifier
p1278.cpp:582:64: error: extended character ’ is not valid in an identifier
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^
p1278.cpp:582:64: error: extended character ’ is not valid in an identifier
p1278.cpp:582:64: error: extended character ’ is not valid in an identifier
p1278.cpp:582:91: error: extended character ’ is not valid in an identifier
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^
p1278.cpp:582:91: error: extended character ’ is not valid in an identifier
p1278.cpp:582:91: error: extended character ’ is not valid in an identifier
p1278.cpp:583:3: error: extended character ’ is not valid in an identifier
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:3: error: extended character ’ is not valid in an identifier
p1278.cpp:583:3: error: extended character ’ is not valid in an identifier
p1278.cpp:583:30: error: extended character ’ is not valid in an identifier
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:30: error: extended character ’ is not valid in an identifier
p1278.cpp:583:30: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:583:57: error: extended character ’ is not valid in an identifier
p1278.cpp:668:4: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:17: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:28: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:39: error: extended character ≥ is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:668:49: error: extended character − is not valid in an identifier
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
p1278.cpp:876:11: error: extended character − is not valid in an identifier
876 | P(i|p)=p·(1−p)i .
| ^
p1278.cpp:994:10: error: extended character − is not valid in an identifier
994 | p(x|λ) = λe−λx .
| ^
p1278.cpp:31:40: error: 'see' was not declared in this scope
31 | concept uniform_random_bit_generator = see below;
| ^~~
p1278.cpp:54:22: error: 'see_below' does not name a type
54 | using minstd_rand0 = see_below;
| ^~~~~~~~~
p1278.cpp:55:21: error: 'see_below' does not name a type
55 | using minstd_rand = see_below;
| ^~~~~~~~~
p1278.cpp:56:17: error: 'see_below' does not name a type
56 | using mt19937 = see_below;
| ^~~~~~~~~
p1278.cpp:57:20: error: 'see_below' does not name a type
57 | using mt19937_64 = see_below;
| ^~~~~~~~~
p1278.cpp:58:23: error: 'see_below' does not name a type
58 | using ranlux24_base = see_below;
| ^~~~~~~~~
p1278.cpp:59:23: error: 'see_below' does not name a type
59 | using ranlux48_base = see_below;
| ^~~~~~~~~
p1278.cpp:60:18: error: 'see_below' does not name a type
60 | using ranlux24 = see_below;
| ^~~~~~~~~
p1278.cpp:61:18: error: 'see_below' does not name a type
61 | using ranlux48 = see_below;
| ^~~~~~~~~
p1278.cpp:62:17: error: 'see_below' does not name a type
62 | using knuth_b = see_below;
| ^~~~~~~~~
p1278.cpp:97:1: error: 'emplate' does not name a type
97 | emplate<class RealType = double>
| ^~~~~~~
p1278.cpp:203:1: error: 'A' does not name a type
203 | A::A();
| ^
p1278.cpp:276:36: error: ISO C++ forbids declaration of 'X' with no type [-fpermissive]
276 | template<class Sseq> explicit X(Sseq& q);
| ^
p1278.cpp:276:27: error: only declarations of constructors and conversion operators can be 'explicit'
276 | template<class Sseq> explicit X(Sseq& q);
| ^~~~~~~~
p1278.cpp:282:36: error: 'template<class UIntType, UIntType a, UIntType c, UIntType m> template<class Sseq> void std::linear_congruential_engine<UIntType, a, c, m>::seed(Sseq&)' cannot be overloaded with 'template<class UIntType, UIntType a, UIntType c, UIntType m> template<class Sseq> void std::linear_congruential_engine<UIntType, a, c, m>::seed(Sseq&)'
282 | template<class Sseq> void seed(Sseq& q);
| ^~~~
p1278.cpp:279:32: note: previous declaration 'template<class UIntType, UIntType a, UIntType c, UIntType m> template<class Sseq> void std::linear_congruential_engine<UIntType, a, c, m>::seed(Sseq&)'
279 | template<class Sseq> void seed(Sseq& q);
| ^~~~
p1278.cpp:285:68: warning: friend declaration 'bool std::operator==(const linear_congruential_engine<UIntType, a, c, m>&, const linear_congruential_engine<UIntType, a, c, m>&)' declares a non-template function [-Wnon-template-friend]
285 | const linear_congruential_engine& y);
| ^
p1278.cpp:285:68: note: (if this is not what you intended, make sure the function template has already been declared and add '<>' after the function name here)
p1278.cpp:301:51: error: expected ')' before 's'
301 | explicit linear_congruential_engine(result_type s);
| ~ ^~
| )
p1278.cpp:309:31: error: deduction guide for 'std::linear_congruential_engine<UIntType, a, c, m>' must have trailing return type
309 | template<class Sseq> explicit linear_congruential_engine(Sseq& q);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:34:13: note: 'template<class UIntType, UIntType a, UIntType c, UIntType m> class std::linear_congruential_engine' declared here
34 | class linear_congruential_engine;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:315:45: error: expected ')' before 'value'
315 | explicit mersenne_twister_engine(result_type value);
| ~ ^~~~~~
| )
p1278.cpp:349:99: warning: friend declaration 'bool std::operator==(const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>&, const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>&)' declares a non-template function [-Wnon-template-friend]
349 | friend bool operator==(const mersenne_twister_engine& x, const mersenne_twister_engine& y);
| ^
p1278.cpp: In static member function 'static constexpr std::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::result_type std::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::max()':
p1278.cpp:341:45: error: unable to find numeric literal operator 'operator""w'
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^~
p1278.cpp:341:45: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:341:48: error: expected ';' before '\U00002212'
341 | static constexpr result_type max() { return 2w − 1; } static constexpr result_type default_seed = 5489u;
| ^
p1278.cpp:341:48: error: '\U00002212' was not declared in this scope
p1278.cpp: At global scope:
p1278.cpp:364:31: error: deduction guide for 'std::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>' must have trailing return type
364 | template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
| ^~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:40:13: note: 'template<class UIntType, long unsigned int w, long unsigned int n, long unsigned int m, long unsigned int r, UIntType a, long unsigned int u, UIntType d, long unsigned int s, UIntType b, long unsigned int t, UIntType c, long unsigned int l, UIntType f> class std::mersenne_twister_engine' declared here
40 | class mersenne_twister_engine;
| ^~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:391:70: warning: friend declaration 'bool std::operator==(const subtract_with_carry_engine<UIntType, w, s, r>&, const subtract_with_carry_engine<UIntType, w, s, r>&)' declares a non-template function [-Wnon-template-friend]
391 | const subtract_with_carry_engine& y);
| ^
p1278.cpp: In static member function 'static constexpr std::subtract_with_carry_engine<UIntType, w, s, r>::result_type std::subtract_with_carry_engine<UIntType, w, s, r>::max()':
p1278.cpp:382:94: error: 'm\U000022121' was not declared in this scope
382 | c constexpr result_type min() { return 0; } static constexpr result_type max() { return m−1; } static constexpr result_type default_seed = 19780503u;
| ^~~
p1278.cpp: At global scope:
p1278.cpp:407:30: error: 'result_type' was not declared in this scope
407 | linear_congruential_engine<result_type,
| ^~~~~~~~~~~
p1278.cpp:408:50: error: template argument 1 is invalid
408 | 40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
| ^
p1278.cpp:408:54: error: 'value' was not declared in this scope
408 | 40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
| ^~~~~
p1278.cpp:408:68: error: 'default_seed' was not declared in this scope
408 | 40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
| ^~~~~~~~~~~~
p1278.cpp:408:83: error: 'value' was not declared in this scope
408 | 40014u,0u,2147483563u> e(value == 0u ? default_seed : value);
| ^~~~~
p1278.cpp:411:51: error: expected ')' before 'value'
411 | explicit subtract_with_carry_engine(result_type value);
| ~ ^~~~~~
| )
p1278.cpp:414:31: error: deduction guide for 'std::subtract_with_carry_engine<UIntType, w, s, r>' must have trailing return type
414 | template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:43:13: note: 'template<class UIntType, long unsigned int w, long unsigned int s, long unsigned int r> class std::subtract_with_carry_engine' declared here
43 | class subtract_with_carry_engine;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:449:93: warning: friend declaration 'bool std::operator==(const discard_block_engine<Engine, p, r>&, const discard_block_engine<Engine, p, r>&)' declares a non-template function [-Wnon-template-friend]
449 | friend bool operator==(const discard_block_engine& x, const discard_block_engine& y);
| ^
p1278.cpp:477:1: error: 'S' does not name a type
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^
p1278.cpp:477:8: error: expected unqualified-id before 'for'
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^~~
p1278.cpp:477:16: error: 'k\U00000338' does not name a type
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^
p1278.cpp:477:21: error: 'k' does not name a type
477 | S = 0; for(k=0;k̸=n0;k+=1) {
| ^
p1278.cpp:480:1: error: expected unqualified-id before 'for'
480 | for(k=n0;k̸=n;k+=1) {
| ^~~
p1278.cpp:480:10: error: 'k\U00000338' does not name a type
480 | for(k=n0;k̸=n;k+=1) {
| ^
p1278.cpp:480:14: error: 'k' does not name a type
480 | for(k=n0;k̸=n;k+=1) {
| ^
p1278.cpp:500:99: warning: friend declaration 'bool operator==(const independent_bits_engine<Engine, w, UIntType>&, const independent_bits_engine<Engine, w, UIntType>&)' declares a non-template function [-Wnon-template-friend]
500 | friend bool operator==(const independent_bits_engine& x, const independent_bits_engine& y);
| ^
p1278.cpp: In static member function 'static constexpr independent_bits_engine<Engine, w, UIntType>::result_type independent_bits_engine<Engine, w, UIntType>::max()':
p1278.cpp:489:94: error: unable to find numeric literal operator 'operator""w'
489 | tic constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^~
p1278.cpp:489:94: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:489:97: error: expected ';' before '\U00002212'
489 | tic constexpr result_type min() { return 0; } static constexpr result_type max() { return 2w − 1; }
| ^
p1278.cpp:489:97: error: '\U00002212' was not declared in this scope
p1278.cpp: At global scope:
p1278.cpp:544:93: warning: friend declaration 'bool std::operator==(const shuffle_order_engine<Engine, k>&, const shuffle_order_engine<Engine, k>&)' declares a non-template function [-Wnon-template-friend]
544 | friend bool operator==(const shuffle_order_engine& x, const shuffle_order_engine& y);
| ^
p1278.cpp:568:44: error: unable to find numeric literal operator 'operator""\U00002019807'
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^~~~~~
p1278.cpp:568:44: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:568:55: error: unable to find numeric literal operator 'operator""\U00002019147\U00002019483\U00002019647'
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^~~~~~~~~~~~~
p1278.cpp:568:55: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:568:68: error: template argument 2 is invalid
568 | linear_congruential_engine<uint_fast32_t, 16’807, 0, 2’147’483’647>;
| ^
p1278.cpp:568:68: error: template argument 4 is invalid
p1278.cpp:576:49: error: unable to find numeric literal operator 'operator""\U00002019271'
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^~~~~~
p1278.cpp:576:49: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:576:60: error: unable to find numeric literal operator 'operator""\U00002019147\U00002019483\U00002019647'
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^~~~~~~~~~~~~
p1278.cpp:576:60: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:576:73: error: template argument 2 is invalid
576 | linear_congruential_engine<uint_fast32_t, 48’271, 0, 2’147’483’647>;
| ^
p1278.cpp:576:73: error: template argument 4 is invalid
p1278.cpp:579:64: error: unable to find numeric literal operator 'operator""\U00002019b0df'
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:64: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:579:81: error: unable to find numeric literal operator 'operator""\U00002019ffff'
579 | mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:81: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:579:97: error: unable to find numeric literal operator 'operator""\U000020195680'
579 | rsenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:97: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:579:114: error: unable to find numeric literal operator 'operator""\U000020190000'
579 | gine<uint_fast32_t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~
p1278.cpp:579:114: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:579:131: error: unable to find numeric literal operator 'operator""\U00002019812\U00002019433\U00002019253'
579 | t, 32, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^~~~~~~~~~~~~
p1278.cpp:579:131: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:579:144: error: template argument 6 is invalid
579 | 2, 624, 397, 31, 0x9908’b0df, 11, 0xffff’ffff, 7, 0x9d2c’5680, 15, 0xefc6’0000, 18, 1’812’433’253>;
| ^
p1278.cpp:579:144: error: template argument 8 is invalid
p1278.cpp:579:144: error: template argument 10 is invalid
p1278.cpp:579:144: error: template argument 12 is invalid
p1278.cpp:579:144: error: template argument 14 is invalid
p1278.cpp:582:64: error: unable to find numeric literal operator 'operator""\U000020196f5a\U00002019a966\U0000201919e9'
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:582:64: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:582:91: error: unable to find numeric literal operator 'operator""\U000020195555\U000020195555\U000020195555'
582 | mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 0xb502’6f5a’a966’19e9, 29, 0x5555’5555’5555’5555, 17,
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:582:91: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:583:3: error: unable to find numeric literal operator 'operator""\U000020197fff\U00002019eda6\U000020190000'
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:583:3: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:583:30: error: unable to find numeric literal operator 'operator""\U00002019eee0\U000020190000\U000020190000'
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:583:30: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:583:57: error: unable to find numeric literal operator 'operator""\U00002019364\U00002019136\U00002019223\U00002019846\U00002019793\U00002019005'
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:583:57: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1278.cpp:583:82: error: template argument 6 is invalid
583 | 0x71d6’7fff’eda6’0000, 37, 0xfff7’eee0’0000’0000, 43, 6’364’136’223’846’793’005>;
| ^
p1278.cpp:583:82: error: template argument 8 is invalid
p1278.cpp:583:82: error: template argument 10 is invalid
p1278.cpp:583:82: error: template argument 12 is invalid
p1278.cpp:583:82: error: template argument 14 is invalid
p1278.cpp:595:38: error: 'minstd_rand0' was not declared in this scope
595 | using knuth_b = shuffle_order_engine<minstd_rand0,256>;
| ^~~~~~~~~~~~
p1278.cpp:595:54: error: template argument 1 is invalid
595 | using knuth_b = shuffle_order_engine<minstd_rand0,256>;
| ^
p1278.cpp:597:31: error: 'implementation' does not name a type
597 | using default_random_engine = implementation-defined;
| ^~~~~~~~~~~~~~
p1278.cpp: In constructor 'std::random_device::random_device()':
p1278.cpp:609:33: error: 'implementation' was not declared in this scope
609 | random_device() : random_device(implementation-defined) {} explicit random_device(const string& token);
| ^~~~~~~~~~~~~~
p1278.cpp:609:48: error: 'defined' was not declared in this scope
609 | random_device() : random_device(implementation-defined) {} explicit random_device(const string& token);
| ^~~~~~~
p1278.cpp: At global scope:
p1278.cpp:619:10: error: ISO C++ forbids declaration of 'random_device' with no type [-fpermissive]
619 | explicit random_device(const string& token);
| ^~~~~~~~~~~~~
p1278.cpp:619:1: error: 'explicit' outside class declaration
619 | explicit random_device(const string& token);
| ^~~~~~~~
p1278.cpp:620:24: error: non-member function 'double entropy()' cannot have cv-qualifier
620 | double entropy() const noexcept;
| ^~~~~~~~
p1278.cpp:622:1: error: 'result_type' does not name a type
622 | result_type operator()();
| ^~~~~~~~~~~
p1278.cpp:653:20: error: expected constructor, destructor, or type conversion before ';' token
653 | seed_seq() noexcept;
| ^
p1278.cpp:655:27: error: 'T' was not declared in this scope
655 | seed_seq(initializer_list<T> il);
| ^
p1278.cpp:655:28: error: template argument 1 is invalid
655 | seed_seq(initializer_list<T> il);
| ^
p1278.cpp:655:33: error: expected constructor, destructor, or type conversion before ';' token
655 | seed_seq(initializer_list<T> il);
| ^
p1278.cpp:659:51: error: expected constructor, destructor, or type conversion before ';' token
659 | seed_seq(InputIterator begin, InputIterator end);
| ^
p1278.cpp:661:1: error: expected unqualified-id before 'for'
661 | for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
| ^~~
p1278.cpp:661:31: error: 's' does not name a type
661 | for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
| ^
p1278.cpp:661:41: error: expected unqualified-id before '++' token
661 | for (InputIterator s = begin; s != end; ++s) v.push_back((*s)mod232);
| ^~
p1278.cpp:668:1: error: 't' does not name a type; did you mean 'tm'?
668 | t=(n≥623)? 11: (n≥68)? 7: (n≥39)? 5: (n≥7)? 3: (n−1)/2;
| ^
| tm
p1278.cpp:676:21: error: non-member function 'size_t size()' cannot have cv-qualifier
676 | size_t size() const noexcept;
| ^~~~~~~~
p1278.cpp:679:35: error: non-member function 'void param(OutputIterator)' cannot have cv-qualifier
679 | void param(OutputIterator dest) const;
| ^~~~~
p1278.cpp:683:7: error: expected constructor, destructor, or type conversion before '(' token
683 | copy(v.begin(), v.end(), dest);
| ^
p1278.cpp:700:12: error: redefinition of default argument for 'class IntType'
700 | template<class IntType = int>
| ^~~~~
p1278.cpp:71:10: note: original definition appeared here
71 | template<class IntType = int>
| ^~~~~
p1278.cpp:732:42: error: expected ')' before 'a'
732 | explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
| ~ ^~
| )
p1278.cpp:736:1: error: 'result_type' does not name a type
736 | result_type a() const;
| ^~~~~~~~~~~
p1278.cpp:743:14: error: redefinition of default argument for 'class RealType'
743 | template<class RealType = double>
| ^~~~~
p1278.cpp:74:10: note: original definition appeared here
74 | template<class RealType = double>
| ^~~~~
p1278.cpp:776:10: error: deduction guide for 'std::uniform_real_distribution<RealType>' must have trailing return type
776 | explicit uniform_real_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:75:9: note: 'template<class RealType> class std::uniform_real_distribution' declared here
75 | class uniform_real_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:789:20: error: 'unspecified' does not name a type
789 | using param_type = unspecified ;
| ^~~~~~~~~~~
p1278.cpp:793:45: error: 'param_type' does not name a type
793 | explicit bernoulli_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:801:47: error: 'param_type' does not name a type
801 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:804:7: error: 'param_type' does not name a type
804 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:805:24: error: 'param_type' does not name a type
805 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:816:10: error: ISO C++ forbids declaration of 'bernoulli_distribution' with no type [-fpermissive]
816 | explicit bernoulli_distribution(double p);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:816:1: error: 'explicit' outside class declaration
816 | explicit bernoulli_distribution(double p);
| ^~~~~~~~
p1278.cpp:820:12: error: non-member function 'double p()' cannot have cv-qualifier
820 | double p() const;
| ^~~~~
p1278.cpp:824:12: error: redefinition of default argument for 'class IntType'
824 | template<class IntType = int>
| ^~~~~
p1278.cpp:79:10: note: original definition appeared here
79 | template<class IntType = int>
| ^~~~~
p1278.cpp:857:39: error: expected ')' before 't'
857 | explicit binomial_distribution(IntType t, double p = 0.5);
| ~ ^~
| )
p1278.cpp:861:1: error: 'IntType' does not name a type
861 | IntType t() const;
| ^~~~~~~
p1278.cpp:866:12: error: redefinition of default argument for 'class IntType'
866 | template<class IntType = int>
| ^~~~~
p1278.cpp:82:10: note: original definition appeared here
82 | template<class IntType = int>
| ^~~~~
p1278.cpp:898:13: error: deduction guide for 'std::geometric_distribution<IntType>' must have trailing return type
898 | explicit geometric_distribution(double p);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:83:9: note: 'template<class IntType> class std::geometric_distribution' declared here
83 | class geometric_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:902:17: error: redefinition of default argument for 'class IntType'
902 | template<class IntType = int>
| ^~~~~
p1278.cpp:85:10: note: original definition appeared here
85 | template<class IntType = int>
| ^~~~~
p1278.cpp:940:48: error: expected ')' before 'k'
940 | explicit negative_binomial_distribution(IntType k, double p = 0.5);
| ~ ^~
| )
p1278.cpp:949:49: error: 'unspecified' does not name a type
949 | using result_type = IntType; using param_type = unspecified ;
| ^~~~~~~~~~~
p1278.cpp:953:46: error: 'param_type' does not name a type
953 | explicit poisson_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:956:93: warning: friend declaration 'bool operator==(const poisson_distribution<IntType>&, const poisson_distribution<IntType>&)' declares a non-template function [-Wnon-template-friend]
956 | friend bool operator==(const poisson_distribution& x, const poisson_distribution& y);
| ^
p1278.cpp:961:50: error: 'param_type' does not name a type
961 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:968:7: error: 'param_type' does not name a type
968 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:969:24: error: 'param_type' does not name a type
969 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:980:10: error: reference to 'poisson_distribution' is ambiguous
980 | explicit poisson_distribution(double mean);
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:89:9: note: candidates are: 'template<class IntType> class std::poisson_distribution'
89 | class poisson_distribution;
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:945:14: note: 'template<class IntType> class poisson_distribution'
945 | class poisson_distribution
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:980:10: error: ISO C++ forbids declaration of 'poisson_distribution' with no type [-fpermissive]
980 | explicit poisson_distribution(double mean);
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:980:1: error: 'explicit' outside class declaration
980 | explicit poisson_distribution(double mean);
| ^~~~~~~~
p1278.cpp:980:42: error: 'int poisson_distribution(double)' redeclared as different kind of entity
980 | explicit poisson_distribution(double mean);
| ^
p1278.cpp:945:14: note: previous declaration 'template<class IntType> class poisson_distribution'
945 | class poisson_distribution
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:984:15: error: non-member function 'double mean()' cannot have cv-qualifier
984 | double mean() const;
| ^~~~~
p1278.cpp:988:12: error: redefinition of default argument for 'class RealType'
988 | template<class RealType = double>
| ^~~~~
p1278.cpp:91:10: note: original definition appeared here
91 | template<class RealType = double>
| ^~~~~
p1278.cpp:1020:10: error: deduction guide for 'std::exponential_distribution<RealType>' must have trailing return type
1020 | explicit exponential_distribution(RealType lambda);
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:92:9: note: 'template<class RealType> class std::exponential_distribution' declared here
92 | class exponential_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1025:17: error: redefinition of default argument for 'class RealType'
1025 | template<class RealType = double>
| ^~~~~
p1278.cpp:94:10: note: original definition appeared here
94 | template<class RealType = double>
| ^~~~~
p1278.cpp:1057:19: error: non-member function 'std::RealType lambda()' cannot have cv-qualifier
1057 | RealType lambda() const;
| ^~~~~
p1278.cpp:1060:13: error: deduction guide for 'std::gamma_distribution<RealType>' must have trailing return type
1060 | explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
| ^~~~~~~~~~~~~~~~~~
p1278.cpp:95:9: note: 'template<class RealType> class std::gamma_distribution' declared here
95 | class gamma_distribution;
| ^~~~~~~~~~~~~~~~~~
p1278.cpp:1064:18: error: non-member function 'std::RealType alpha()' cannot have cv-qualifier
1064 | RealType alpha() const;
| ^~~~~
p1278.cpp:1073:50: error: 'unspecified' does not name a type
1073 | using result_type = RealType; using param_type = unspecified ;
| ^~~~~~~~~~~
p1278.cpp:1079:43: error: 'param_type' does not name a type
1079 | explicit weibull_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1082:90: warning: friend declaration 'bool std::operator==(const weibull_distribution<RealType>&, const weibull_distribution<RealType>&)' declares a non-template function [-Wnon-template-friend]
1082 | friend bool operator==(const weibull_distribution& x, const weibull_distribution& y);
| ^
p1278.cpp:1087:47: error: 'param_type' does not name a type
1087 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1091:7: error: 'param_type' does not name a type
1091 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:1092:24: error: 'param_type' does not name a type
1092 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1103:10: error: deduction guide for 'std::weibull_distribution<RealType>' must have trailing return type
1103 | explicit weibull_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:1070:9: note: 'template<class RealType> class std::weibull_distribution' declared here
1070 | class weibull_distribution {
| ^~~~~~~~~~~~~~~~~~~~
p1278.cpp:1104:17: error: non-member function 'std::RealType a()' cannot have cv-qualifier
1104 | RealType a() const;
| ^~~~~
p1278.cpp:1110:12: error: redefinition of default argument for 'class RealType'
1110 | template<class RealType = double>
| ^~~~~
p1278.cpp:100:10: note: original definition appeared here
100 | template<class RealType = double>
| ^~~~~
p1278.cpp:1146:10: error: deduction guide for 'std::extreme_value_distribution<RealType>' must have trailing return type
1146 | explicit extreme_value_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:101:9: note: 'template<class RealType> class std::extreme_value_distribution' declared here
101 | class extreme_value_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1147:14: error: non-member function 'std::RealType a()' cannot have cv-qualifier
1147 | RealType a() const;
| ^~~~~
p1278.cpp:1152:17: error: redefinition of default argument for 'class RealType'
1152 | template<class RealType = double>
| ^~~~~
p1278.cpp:103:10: note: original definition appeared here
103 | template<class RealType = double>
| ^~~~~
p1278.cpp:1184:13: error: deduction guide for 'std::normal_distribution<RealType>' must have trailing return type
1184 | explicit normal_distribution(RealType mean, RealType stddev = 1.0);
| ^~~~~~~~~~~~~~~~~~~
p1278.cpp:104:9: note: 'template<class RealType> class std::normal_distribution' declared here
104 | class normal_distribution;
| ^~~~~~~~~~~~~~~~~~~
p1278.cpp:1190:17: error: non-member function 'std::RealType mean()' cannot have cv-qualifier
1190 | RealType mean() const;
| ^~~~~
p1278.cpp:1190:10: error: ambiguating new declaration of 'std::RealType mean()'
1190 | RealType mean() const;
| ^~~~
p1278.cpp:984:8: note: old declaration 'double mean()'
984 | double mean() const;
| ^~~~
p1278.cpp:1192:22: error: non-member function 'std::RealType stddev()' cannot have cv-qualifier
1192 | RealType stddev() const;
| ^~~~~
p1278.cpp:1198:12: error: redefinition of default argument for 'class RealType'
1198 | template<class RealType = double>
| ^~~~~
p1278.cpp:106:10: note: original definition appeared here
106 | template<class RealType = double>
| ^~~~~
p1278.cpp:1232:10: error: deduction guide for 'std::lognormal_distribution<RealType>' must have trailing return type
1232 | explicit lognormal_distribution(RealType m, RealType s = 1.0);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:107:9: note: 'template<class RealType> class std::lognormal_distribution' declared here
107 | class lognormal_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1233:14: error: non-member function 'std::RealType m()' cannot have cv-qualifier
1233 | RealType m() const;
| ^~~~~
p1278.cpp:1239:14: error: redefinition of default argument for 'class RealType'
1239 | template<class RealType = double>
| ^~~~~
p1278.cpp:109:10: note: original definition appeared here
109 | template<class RealType = double>
| ^~~~~
p1278.cpp:1270:10: error: deduction guide for 'std::chi_squared_distribution<RealType>' must have trailing return type
1270 | explicit chi_squared_distribution(RealType n);
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:110:9: note: 'template<class RealType> class std::chi_squared_distribution' declared here
110 | class chi_squared_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1274:14: error: non-member function 'std::RealType n()' cannot have cv-qualifier
1274 | RealType n() const;
| ^~~~~
p1278.cpp:1278:14: error: redefinition of default argument for 'class RealType'
1278 | template<class RealType = double>
| ^~~~~
p1278.cpp:112:10: note: original definition appeared here
112 | template<class RealType = double> class cauchy_distribution;
| ^~~~~
p1278.cpp:1310:10: error: deduction guide for 'std::cauchy_distribution<RealType>' must have trailing return type
1310 | explicit cauchy_distribution(RealType a, RealType b = 1.0);
| ^~~~~~~~~~~~~~~~~~~
p1278.cpp:112:42: note: 'template<class RealType> class std::cauchy_distribution' declared here
112 | template<class RealType = double> class cauchy_distribution;
| ^~~~~~~~~~~~~~~~~~~
p1278.cpp:1314:14: error: non-member function 'std::RealType a()' cannot have cv-qualifier
1314 | RealType a() const;
| ^~~~~
p1278.cpp:1321:14: error: redefinition of default argument for 'class RealType'
1321 | template<class RealType = double>
| ^~~~~
p1278.cpp:123:10: note: original definition appeared here
123 | template<class RealType = double>
| ^~~~~
p1278.cpp:1353:10: error: deduction guide for 'std::fisher_f_distribution<RealType>' must have trailing return type
1353 | explicit fisher_f_distribution(RealType m, RealType n = 1);
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:124:16: note: 'template<class RealType> class std::fisher_f_distribution' declared here
124 | class fisher_f_distribution;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1358:14: error: non-member function 'std::RealType m()' cannot have cv-qualifier
1358 | RealType m() const;
| ^~~~~
p1278.cpp:1363:14: error: redefinition of default argument for 'class RealType'
1363 | template<class RealType = double>
| ^~~~~
p1278.cpp:126:10: note: original definition appeared here
126 | template<class RealType = double>
| ^~~~~
p1278.cpp:1394:10: error: deduction guide for 'std::student_t_distribution<RealType>' must have trailing return type
1394 | explicit student_t_distribution(RealType n);
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:127:16: note: 'template<class RealType> class std::student_t_distribution' declared here
127 | class student_t_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1400:17: error: redefinition of default argument for 'class IntType'
1400 | template<class IntType = int>
| ^~~~~
p1278.cpp:129:10: note: original definition appeared here
129 | template<class IntType = int>
| ^~~~~
p1278.cpp:1438:1: error: deduction guide for 'std::discrete_distribution<IntType>' must have trailing return type
1438 | discrete_distribution();
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:130:16: note: 'template<class IntType> class std::discrete_distribution' declared here
130 | class discrete_distribution;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1441:3: error: deduction guide for 'std::discrete_distribution<IntType>' must have trailing return type
1441 | discrete_distribution(InputIterator firstW, InputIterator lastW);
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:130:16: note: 'template<class IntType> class std::discrete_distribution' declared here
130 | class discrete_distribution;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1444:1: error: deduction guide for 'std::discrete_distribution<IntType>' must have trailing return type
1444 | discrete_distribution(initializer_list<double> wl);
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:130:16: note: 'template<class IntType> class std::discrete_distribution' declared here
130 | class discrete_distribution;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1446:60: error: 'UnaryOperation' has not been declared
1446 | discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
| ^~~~~~~~~~~~~~
p1278.cpp:1446:1: error: deduction guide for 'std::discrete_distribution<IntType>' must have trailing return type
1446 | discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:130:16: note: 'template<class IntType> class std::discrete_distribution' declared here
130 | class discrete_distribution;
| ^~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1457:11: error: 'std::piecewise_constant_distribution' is not a template
1457 | class piecewise_constant_distribution {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:132:16: note: previous declaration here
132 | class piecewise_constant_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1497:39: error: expected constructor, destructor, or type conversion before ';' token
1497 | piecewise_constant_distribution();
| ^
p1278.cpp:1501:51: error: expected constructor, destructor, or type conversion before ';' token
1501 | InputIteratorW firstW);
| ^
p1278.cpp:1507:83: error: expected constructor, destructor, or type conversion before ';' token
1507 | piecewise_constant_distribution(initializer_list<RealType> bl, UnaryOperation fw);
| ^
p1278.cpp:1511:75: error: 'UnaryOperation' has not been declared
1511 | piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ^~~~~~~~~~~~~~
p1278.cpp:1511:93: error: expected constructor, destructor, or type conversion before ';' token
1511 | piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ^
p1278.cpp:1517:8: error: 'result_type' was not declared in this scope
1517 | vector<result_type> densities() const;
| ^~~~~~~~~~~
p1278.cpp:1517:19: error: template argument 1 is invalid
1517 | vector<result_type> densities() const;
| ^
p1278.cpp:1517:19: error: template argument 2 is invalid
p1278.cpp:1517:33: error: non-member function 'int densities()' cannot have cv-qualifier
1517 | vector<result_type> densities() const;
| ^~~~~
p1278.cpp:1523:10: error: deduction guide for 'std::piecewise_linear_distribution<RealType>' must have trailing return type
1523 | piecewise_linear_distribution();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1525:12: error: deduction guide for 'std::piecewise_linear_distribution<RealType>' must have trailing return type
1525 | piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1528:12: error: deduction guide for 'std::piecewise_linear_distribution<RealType>' must have trailing return type
1528 | piecewise_linear_distribution(initializer_list<RealType> bl, UnaryOperation fw);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1530:12: error: deduction guide for 'std::piecewise_linear_distribution<RealType>' must have trailing return type
1530 | piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1531:55: error: 'param_type' does not name a type
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1531:19: error: deduction guide for 'std::piecewise_linear_distribution<RealType>' must have trailing return type
1531 | explicit piecewise_linear_distribution(const param_type& parm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1534:10: error: 'friend' used outside of class
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ^~~~~~
| ------
p1278.cpp:1534:33: error: template placeholder type 'const piecewise_linear_distribution<...auto...>' must be followed by a simple declarator-id
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ^~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1534:71: error: expected ')' before ',' token
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ~ ^
| )
p1278.cpp:1534:22: error: 'bool operator==(...)' must have an argument of class or enumerated type
1534 | friend bool operator==(const piecewise_linear_distribution& x,
| ^~~~~~~~
p1278.cpp:1535:33: error: expected unqualified-id before 'const'
1535 | const piecewise_linear_distribution& y);
| ^~~~~
p1278.cpp:1538:12: error: 'result_type' does not name a type
1538 | result_type operator()(URBG& g);
| ^~~~~~~~~~~
p1278.cpp:1540:12: error: 'result_type' does not name a type
1540 | result_type operator()(URBG& g, const param_type& parm);
| ^~~~~~~~~~~
p1278.cpp:1542:17: error: 'result_type' was not declared in this scope
1542 | vector<result_type> intervals() const;
| ^~~~~~~~~~~
p1278.cpp:1542:28: error: template argument 1 is invalid
1542 | vector<result_type> intervals() const;
| ^
p1278.cpp:1542:28: error: template argument 2 is invalid
p1278.cpp:1542:42: error: non-member function 'int intervals()' cannot have cv-qualifier
1542 | vector<result_type> intervals() const;
| ^~~~~
p1278.cpp:1543:17: error: 'result_type' was not declared in this scope
1543 | vector<result_type> densities() const;
| ^~~~~~~~~~~
p1278.cpp:1543:28: error: template argument 1 is invalid
1543 | vector<result_type> densities() const;
| ^
p1278.cpp:1543:28: error: template argument 2 is invalid
p1278.cpp:1543:42: error: non-member function 'int densities()' cannot have cv-qualifier
1543 | vector<result_type> densities() const;
| ^~~~~
p1278.cpp:1544:10: error: 'param_type' does not name a type
1544 | param_type param() const;
| ^~~~~~~~~~
p1278.cpp:1545:27: error: 'param_type' does not name a type
1545 | void param(const param_type& parm);
| ^~~~~~~~~~
p1278.cpp:1546:10: error: 'result_type' does not name a type
1546 | result_type min() const;
| ^~~~~~~~~~~
p1278.cpp:1547:10: error: 'result_type' does not name a type
1547 | result_type max() const;
| ^~~~~~~~~~~
p1278.cpp:1550:12: error: 'friend' used outside of class
1550 | friend basic_ostream<charT, traits>&
| ^~~~~~
| ------
p1278.cpp:1551:59: error: template placeholder type 'const piecewise_linear_distribution<...auto...>' must be followed by a simple declarator-id
1551 | operator<<(basic_ostream<charT, traits>& os, const piecewise_linear_distribution& x);
| ^~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1551:14: error: 'std::basic_ostream<_CharT, _Traits>& operator<<(...)' must have an argument of class or enumerated type
1551 | operator<<(basic_ostream<charT, traits>& os, const piecewise_linear_distribution& x);
| ^~~~~~~~
p1278.cpp:1553:12: error: 'friend' used outside of class
1553 | friend basic_istream<charT, traits>&
| ^~~~~~
| ------
p1278.cpp:1554:59: error: template placeholder type 'piecewise_linear_distribution<...auto...>' must be followed by a simple declarator-id
1554 | operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1554:14: error: 'std::basic_istream<_CharT, _Traits>& operator>>(...)' must have an argument of class or enumerated type
1554 | operator>>(basic_istream<charT, traits>& is, piecewise_linear_distribution& x);
| ^~~~~~~~
p1278.cpp:1555:1: error: expected declaration before '}' token
1555 | }; }
| ^
p1278.cpp:1555:4: error: expected declaration before '}' token
1555 | }; }
| ^
p1278.cpp:1556:4: error: deduction guide for 'std::piecewise_linear_distribution<RealType>' must have trailing return type
1556 | piecewise_linear_distribution();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:135:16: note: 'template<class RealType> class std::piecewise_linear_distribution' declared here
135 | class piecewise_linear_distribution;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1278.cpp:1558:12: error: redefinition of default argument for 'class RealType'
1558 | template<class RealType = double>
| ^~~~~
p1278.cpp:134:10: note: original definition appeared here
134 | template<class RealType = double>
| ^~~~~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
応用例1 AUTOSAR C++
AUTOSARでC++のコーディング標準を作っている。
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。
Autosar Guidelines C++14 example code compile list
応用例2 MISRA C++
MISRA C++, AUTOSAR C++について
MISRA C++ 5-0-16
応用例3 CERT C++
MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする
応用例4 箱庭
箱庭ではUnityをはじめC++を使っているらしい。
ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。
仮想戦略会議「箱庭」
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(1)
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(2)
参考資料(reference)
エンジニア夏休み企画 個人開発
自己参考資料(self reference)
関連する自己参照以外は、こちらの先頭に移転。
C言語(C++)に対する誤解、曲解、無理解、爽快。
#include "N4910.h"
C++N4910資料の改善点
dockerにclang
docker gnu(gcc/g++) and llvm(clang/clang++)
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
C++N4910:2022 tag follower 300人超えました。ありがとうございます。
astyle 使ってみた
【個人開発】 効率的な背景 <エンジニア夏休み企画>
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220817