Topic: Inline variables - superior of templates and constexpr.


Author: sasho648 <sasho648@mail.bg>
Date: Tue, 16 Dec 2014 10:50:46 -0800 (PST)
Raw View
------=_Part_4312_465891630.1418755846264
Content-Type: multipart/alternative;
 boundary="----=_Part_4313_515248448.1418755846265"

------=_Part_4313_515248448.1418755846265
Content-Type: text/plain; charset=UTF-8

As the title says - I'm purposing the introduction of a new variables
specifier - 'inline', which will indicate that their value is known at
compile-time. [Literals aren't itself 'inline' variables, so an reference
to 'inline' variable can't bound to literal.] The motivation of introducing
it is enabling static checks at functions, native 'read-only public' class
member specifiers and creating more optimized code.

Example of the first one can be given by using 'std::array' if we access an
object of the type using the 'operator[]' and 'constexpr' with invalid
index no compiler warning or even an error will be introduced:


array<int, 5> arr;

cout << arr[98] << endl; //compiles just fine

Life example <http://melpon.org/wandbox/permlink/6AUCctBG2H1gYwXq>.

You'll say - this is too obvious - no one will do such thing but let's
imagine that we are going to access the array element, instead of a
literal, by some constexpr function.

constexpr int EvaluateSpecialArrayIndex(int a)
{ return a * sizeof(int); }

cout << arr[EvaluateSpecialArrayIndex(4)] << endl;

Now things get complex, huh? In order to check if the array index is valid
we should first multiply by hand 4 * sizeof(int) and compare it with the
array size. You think now - hey but why don't you add a static_assert in
the 'EvaluateSpecialArrayIndex' and check 'a' with the array size. But the
truth is - that you can't do that as the parameter 'a' isn't required to be
'constexpr', neither the return value of the function. Example on valid
'constexpr' call with 'lvalue':


int a = rand() % 4; //lvalue

cout << arr[EvaluateSpecialArrayIndex(a)] << endl; // also valid

Life example <http://melpon.org/wandbox/permlink/DLuQZd1ECewZkpxQ>.

So this piece of code is invalid:

constexpr int EvaluateSpecialArrayIndex(int a)
{ static_assert( a < 5, "invalid a" ); return a * sizeof(int); }


Life example <http://melpon.org/wandbox/permlink/z9uxsbpr9irk2LBR>.

Here is where 'inline' variables came in use. They can be initialized only
once with another 'inline' variable or with literal but aren't 'const' and
non-'inline' variables can't be casted to 'inline'. However the opposite is
possible (casting from 'inline' to any other type). Functions declared with
'inline' parameters or return-value will be implicit 'inline' themselves.
Instance to a function with argument literal will first search for one with
parameter of type 'inline <type-of-literal>'. So now we could overload the
'std::array::operator[]' in order to do static checks on 'inline' variables
like this (supposing that 'templates' are still used):

template<typename T, size_t sz>
T & std::array::operator[]( size_type pos )

{
    static_assert( pos < sz, "invalid array index" );

    return this->operator[]((int)pos); //instance default 'non-inline'
(run-time) operator[] with 'a' casted (from 'inline int') to 'int'
}


By using the above function this invalid code:

array<int, 5> arr;

cout << arr[98] << endl;

Will report compiler error, instead of producing undefined behavior.

The other usage of the specifier, optimizing code, can be demonstrated by
creating one general function - for both 'inline' and 'non-inline'
parameters, of certain algorithm and other 2 for 'inline' and 'non-inline'
which will specialize it, so when you call it with for example literal - it
will be evaluated at compile-time and when you do with some variable it
will create code for run-time execution. Example:

auto SomeAlgo(inline bool bIsInline, typename( bIsInline ? inline int : int
) n) -> decltype(n)
{
    //Do something with 'n' and return 'int' (or 'inline int')
}

inline int SomeAlgo(inline int a) { static_assert( a < 0, "invalid a" );
return SomeAlgo(true, a); }

int SomeAlgo(int a) { return SomeAlgo(false, a); }

*Note that the first function is declared as returning an 'inline int', if
it was the function itself to be 'inline', it should be 'int inline
SomeAlgo', which is an inline function returning 'int'.*

And some example instances of 'SomeAlgo':

SomeAlgo(rand()); //it will invoke code creation as 'rand()' doesn't return
'inline' value

SomeAlgo(9); //Will evaluate at compile-time as literal '9' can be used to
initialize 'inline' variables

Another useful feature will be the use of 'inline references' which are
such that will point at some compiler-known location (nothing special),
they'll be useful when you want to create a public const reference to some
private member in order to allow public read-only access to it. For now we
could only write this:

class A
{
    int _a;

public:

    const int &a = _a;
} ;

Life example <http://melpon.org/wandbox/permlink/2Ffi7NKWf86cmcQ6>.

But in the case memory for 'a' will be allocated for each 'A' instance,
which is not a deal. We couldn't write this with 'constexpr' for some
strange reason:

class A
{
    int _a;

public:

    constexpr int &a = _a; // the same as 'const int & constexpr a' - still
produces error
} ;

Life example <http://melpon.org/wandbox/permlink/fGWsVP2bcqhG3zBa>.

By using our new construct this could write this:

class A
{
    int _a;

public:

    const int & inline a = _a; // inline reference to '_a'
} ;

Which basically means that each reference to 'a', will be evaluated like -
'(const int)_a', so no additional memory will be created now.

Function specialization will be done to functions with 'inline' parameters,
which when receive argument values will search for a function which have
specialized them. The parameter specialization will be done via the '=='
operator (one specialization can be for multiples values). Examples

auto FuncAdd(inline typename T, T a, T b) -> T //general function
{
    return a + b;
}

auto FuncAdd(inline typename T == int, T a, T b) -> T //specialized
function about the 'T' parameter, as no inline params, no implicit 'inline'
conversion
{
    cout << "I can deal with int" << endl;

    return a + b;
}

And some 'FuncAdd' instances:

FuncAdd(int, 9, 5); // 'FuncAdd' int specialization called (of type - 'auto
(inline typename T == int, T a, T b) -> T')

FuncAdd(double, 3.14f, 1); // 'FuncAdd' general called (of type - 'auto
(inline typename T, T a, T b) -> T')


Some additional 'inline' specifier rules connected to specialization and
classes. A class can have special methods for 'inline' instances of it,
which are defined by specifiying 'inline' after it's declaration (in such
methods 'this' will be inline pointer and will point to an sequenced
'inline'  array holding it's inline member objects). Inline instances of
class will instance only it's special 'inline-this' methods and won't
create any memory for it's non-inline members. Classes can't be specialized
but you can create a derived class which specialize their methods. But this
could change on request.

So what do you think about it - does it have the potential to drop both
'template' and 'constexpr' as keywords?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4313_515248448.1418755846265
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">As the title says - I'm purposing the introduction of a ne=
w variables specifier - 'inline', which will indicate that their value is k=
nown at compile-time. [Literals aren't itself 'inline' variables, so an ref=
erence to 'inline' variable can't bound to literal.] The motivation of intr=
oducing it is enabling static checks at functions, native 'read-only public=
' class member specifiers and creating more optimized code.<br><br>Example =
of the first one can be given by using 'std::array' if we access an object =
of the type using the 'operator[]' and 'constexpr' with invalid index no co=
mpiler warning or even an error will be introduced:<br><br><div>&nbsp; &nbs=
p;&nbsp;</div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187=
, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">array</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; <br>co=
ut </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">98</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">]</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> endl</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//compiles just fine</span></div></code></div><div><br></div><div>Life <a =
href=3D"http://melpon.org/wandbox/permlink/6AUCctBG2H1gYwXq">example</a>.</=
div><div><br></div><div>You'll say - this is too obvious - no one will do s=
uch thing but let's imagine that we are going to access the array element, =
instead of a literal, by some constexpr function.<br><br><div></div></div><=
div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); wo=
rd-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">constexpr</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
EvaluateSpecialArrayIndex</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> a </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">sizeof</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br><br>cout </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> arr</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">[</span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">EvaluateSpecialArrayIndex</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" cl=
ass=3D"styled-by-prettify">4</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">)]</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
endl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n></div></code></div><div><br>Now things get complex, huh? In order to chec=
k if the array index is valid we should first multiply by hand 4 * sizeof(i=
nt) and compare it with the array size. You think now - hey but why don't y=
ou add a static_assert in the 'EvaluateSpecialArrayIndex' and check 'a' wit=
h the array size. But the truth is - that you can't do that as the paramete=
r 'a' isn't required to be 'constexpr', neither the return value of the fun=
ction. Example on valid 'constexpr' call with 'lvalue':<br></div><div><br><=
/div><div><br></div><div><div class=3D"prettyprint" style=3D"border: 1px so=
lid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 2=
50, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span =
style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> rand</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">%</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">4</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">//lvalue</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br><br>cout </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> arr</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">[</span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">EvaluateSpecialArrayIndex</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">a</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)]</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> endl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #800;" class=3D"styled-by-prettify">// also valid</spa=
n></div></code></div><span class=3D"styled-by-prettify" style=3D"font-famil=
y: monospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250)=
;"><br></span>Life <a href=3D"http://melpon.org/wandbox/permlink/DLuQZd1ECe=
wZkpxQ">example</a>.<br><br></div><div>So this piece of code is invalid:</d=
iv><div><br></div><div><div class=3D"prettyprint" style=3D"border: 1px soli=
d rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250=
, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">EvaluateSpecialArrayIndex</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">static_assert</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066=
;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">"invalid a"</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">);=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">sizeof</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span>=
</div></code></div><div><br></div><br>Life <a href=3D"http://melpon.org/wan=
dbox/permlink/z9uxsbpr9irk2LBR">example</a>.</div><div><br></div><div>Here =
is where 'inline' variables came in use. They can be initialized only once =
with another 'inline' variable or with literal but aren't 'const' and non-'=
inline' variables can't be casted to 'inline'. However the opposite is poss=
ible (casting from 'inline' to any other type). Functions declared with 'in=
line' parameters or return-value will be implicit 'inline' themselves. Inst=
ance to a function with argument literal will first search for one with par=
ameter of type 'inline &lt;type-of-literal&gt;'. So now we could overload t=
he 'std::array::operator[]' in order to do static checks on 'inline' variab=
les like this (supposing that 'templates' are still used):<br><br></div><di=
v class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word=
-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
size_t sz</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>T <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">array</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">operator</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">[](</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> size_type pos </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br><br></span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">static_assert</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> pos </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> sz</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #080;" class=3D"styled-by-prettify">"invalid array index"</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">this</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">operator</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">[]((</span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">pos</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #800;" class=3D"styled-by-prettify">//instance d=
efault 'non-inline' (run-time) operator[] with 'a' casted (from 'inline int=
') to 'int'</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</sp=
an></div></code></div><div><span class=3D"br0" style=3D"line-height: 14.079=
9999237061px; color: rgb(0, 128, 0); font-family: DejaVuSansMono, 'DejaVu S=
ans Mono', courier, monospace; font-size: 12.8000001907349px; white-space: =
nowrap;"><br></span></div><div><span class=3D"br0" style=3D"line-height: 14=
..0799999237061px; color: rgb(0, 128, 0); font-family: DejaVuSansMono, 'Deja=
Vu Sans Mono', courier, monospace; font-size: 12.8000001907349px; white-spa=
ce: nowrap;"><br></span></div><div>By using the above function this invalid=
 code:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187=
, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">array</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; <br>co=
ut </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">98</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">]</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> endl</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span></div></code></div><span class=3D"styled-by-pret=
tify" style=3D"font-family: monospace; color: rgb(102, 102, 0); background-=
color: rgb(250, 250, 250);"><br></span>Will report compiler error, instead =
of producing undefined behavior.</div><div><br></div><div>The other usage o=
f the specifier, optimizing code, can be demonstrated by creating one gener=
al function - for both 'inline' and 'non-inline' parameters, of certain alg=
orithm and other 2 for 'inline' and 'non-inline' which will specialize it, =
so when you call it with for example literal - it will be evaluated at comp=
ile-time and when you do with some variable it will create code for run-tim=
e execution. Example:</div><div><br></div><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">SomeAlgo</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">bool</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> bIsInline</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">typename</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> bIs=
Inline </span><span style=3D"color: #660;" class=3D"styled-by-prettify">?</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">decltype</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">n</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">//Do something with=
 'n' and return 'int' (or 'inline int')</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div clas=
s=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap:=
 break-word; background-color: rgb(250, 250, 250);"><code class=3D"prettypr=
int"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">SomeAlgo</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">static_asse=
rt</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by=
-prettify">"invalid a"</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">SomeAlgo</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">true</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">SomeAlgo</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #606;" class=3D"styled-by-prettify">SomeAlgo</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">false</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span></div></code></div><div><span style=3D"color: rgb(102, 0, 102); fon=
t-family: monospace; background-color: rgb(250, 250, 250);"><br></span><i>N=
ote that the first function is declared as returning an 'inline int', if it=
 was the function itself to be 'inline', it should be 'int inline SomeAlgo'=
, which is an inline function returning 'int'.</i><span style=3D"font-famil=
y: monospace; color: rgb(102, 0, 102); background-color: rgb(250, 250, 250)=
;"><br></span></div><div><span style=3D"font-family: monospace; color: rgb(=
102, 0, 102); background-color: rgb(250, 250, 250);"><br></span></div><div>=
And some example instances of 'SomeAlgo':<span style=3D"font-family: monosp=
ace; color: rgb(102, 0, 102); background-color: rgb(250, 250, 250);"><br><b=
r></span></div><div><div class=3D"prettyprint" style=3D"border: 1px solid r=
gb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 2=
50);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #606;" class=3D"styled-by-prettify">SomeAlgo</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">rand</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">());</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//it will invoke code creation as 'rand()' doesn't return =
'inline' value</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br><br></span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">SomeAlgo</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">9</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">//Will evaluate at compile-time as =
literal '9' can be used to initialize 'inline' variables</span></div></code=
></div><br>Another useful feature will be the use of 'inline references' wh=
ich are such that will point at some compiler-known location (nothing speci=
al), they'll be useful when you want to create a public const reference to =
some private member in order to allow public read-only access to it. For no=
w we could only write this:<br><br><div class=3D"prettyprint" style=3D"bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: =
rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettypri=
nt"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> A<br></span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> _a</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">public</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> _a</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span></div></code></div><div><br></div></div><div>Life <a=
 href=3D"http://melpon.org/wandbox/permlink/2Ffi7NKWf86cmcQ6">example</a>.<=
/div><div><br></div><div>But in the case memory for 'a' will be allocated f=
or each 'A' instance, which is not a deal. We couldn't write this with 'con=
stexpr' for some strange reason:<br><br><div class=3D"prettyprint" style=3D=
"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-co=
lor: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> A<br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> _a</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">public</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">constexpr</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
a </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> _a</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
800;" class=3D"styled-by-prettify">// the same as 'const int &amp; constexp=
r a' - still produces error</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
></div></code></div><span class=3D"styled-by-prettify" style=3D"font-family=
: monospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);=
"><br></span>Life <a href=3D"http://melpon.org/wandbox/permlink/fGWsVP2bcqh=
G3zBa">example</a>.<br><br>By using our new construct this could write this=
:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> A<br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> _a</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>public</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbs=
p; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> a </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> _a</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// inlin=
e reference to '_a'</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div><=
/code></div><span class=3D"styled-by-prettify" style=3D"font-family: monosp=
ace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"><br></=
span>Which basically means that each reference to 'a', will be evaluated li=
ke - '(const int)_a', so no additional memory will be created now.</div><di=
v><br></div><div>Function specialization will be done to functions with 'in=
line' parameters, which when receive argument values will search for a func=
tion which have specialized them. The parameter specialization will be done=
 via the '=3D=3D' operator (one specialization can be for multiples values)=
.. Examples<br><br></div><div class=3D"prettyprint" style=3D"border: 1px sol=
id rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 25=
0, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">FuncAdd</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T a=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> T b</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T </span><span style=3D"color: #800;" class=3D"=
styled-by-prettify">//general function</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> a </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">+</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> b</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">FuncAdd</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">typename</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> T </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T a</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> T b</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">-&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> T </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//sp=
ecialized function about the 'T' parameter, as no inline params, no implici=
t 'inline' conversion</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
&nbsp; &nbsp; cout </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">"I=
 can deal with int"</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> e=
ndl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &=
nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">retu=
rn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">+</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span></div></code></div><div><div><br>And so=
me 'FuncAdd' instances:<br><br></div></div><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #606;" class=3D"styled-by-prettify">FuncA=
dd</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">9</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">// 'FuncAdd' int spe=
cialization called (of type - 'auto (inline typename T =3D=3D int, T a, T b=
) -&gt; T')</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br></span><span style=3D"color: #606;" class=3D"styled-by-prettify">F=
uncAdd</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">double</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #066;" class=3D"styled-by-prettify">3.14f</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"sty=
led-by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// 'FuncA=
dd' general called (of type - 'auto (inline typename T, T a, T b) -&gt; T')=
</span></div></code></div><div><br></div><div><br></div><div>Some additiona=
l 'inline' specifier rules connected to specialization and classes. A class=
 can have special methods for 'inline' instances of it, which are defined b=
y specifiying 'inline' after it's declaration (in such methods 'this' will =
be inline pointer and will point to an sequenced 'inline' &nbsp;array holdi=
ng it's inline member objects). Inline instances of class will instance onl=
y it's special 'inline-this' methods and won't create any memory for it's n=
on-inline members. Classes can't be specialized but you can create a derive=
d class which specialize their methods. But this could change on request.</=
div><div><br></div><div>So what do you think about it - does it have the po=
tential to drop both 'template' and 'constexpr' as keywords?</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4313_515248448.1418755846265--
------=_Part_4312_465891630.1418755846264--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Tue, 16 Dec 2014 11:51:21 -0800
Raw View
On Tuesday 16 December 2014 10:50:46 sasho648 wrote:
> template<typename T, size_t sz>
> T & std::array::operator[]( size_type pos )
>
> {
>     static_assert( pos < sz, "invalid array index" );
>
>     return this->operator[]((int)pos); //instance default 'non-inline'
> (run-time) operator[] with 'a' casted (from 'inline int') to 'int'
> }

Did you forget the inline before size_type above?

Also, it seems to me that dropping the inlineness by a simple cast is a bad
idea. It should be preserved and propagated across uses so code further down
the line can benefit from compile-time checks too.

I think the code above might be better written instead as:

template<typename T, size_t sz>
T &std::array<T,sz>::operator[](size_type pos)
{
 if (std::is_constexpr(pos))
  static_assert(pos < sz, "invalid index");

 // call internal, private function
 return this->_Internal_get(pos);
}

Where std::is_consteexpr is similar to the GCC builtin __builtin_constant_p,
but ensures that the static_assert won't be tried if the condition failed.

That syntax would also allow:

constexpr uint32_t crc32(uint32 partial_crc32 uint64 data)
{
 if (!std::is_constexpr(partial_crc32, data)) {
  asm ("crc32 %1, %0" : "+r" (partial_crc32) : "r" (data));
 } else {
  // inline, constexpr implementation of CRC32
 }
 return partial_crc32;
}

Why you may want to do that, you ask? Because the inline & constexpr
implementation of CRC32 results in slower runtime code compared to the CPU
instruction, but is required because the compiler doesn't know what the inline
assembly does and is technically constexpr too.

> auto SomeAlgo(inline bool bIsInline, typename( bIsInline ? inline int : int
> ) n) -> decltype(n)
> {
>     //Do something with 'n' and return 'int' (or 'inline int')
> }

Whoa, whole new syntax here. You should probably send a proposal for the new
syntax first, before we discuss inline variables.

> inline int SomeAlgo(inline int a) { static_assert( a < 0, "invalid a" );
> return SomeAlgo(true, a); }
>
> int SomeAlgo(int a) { return SomeAlgo(false, a); }
>
> *Note that the first function is declared as returning an 'inline int', if
> it was the function itself to be 'inline', it should be 'int inline
> SomeAlgo', which is an inline function returning 'int'.*

No go. You can't change that syntax now.

> So what do you think about it - does it have the potential to drop both
> 'template' and 'constexpr' as keywords?

No, I don't think so. But this is my opinion. That said, one aspect of what
you described solves something I want: the ability to have runtime code differ
from the constexpr implementation. One solution is what I've showed, with a
builtin intrinsic that allows me to check; another is to allow one to overload
a constexpr function with a non-constexpr one.

And when I hear "inline variables", by parallel with template variables, I
somehow think of something like an automatically-updated variable:

 int i;
 inline int j = i * 4;   // no warning

 i = 4;
 std::cout << j << endl;  // prints 16
 i = 1;
 std::cout << j << endl;  // prints 4

 template<typename T> inline int fourth = i / T(4);
 std::cout << fourth<int> << endl; // prints 0
 std::cout << fourth<float> << endl; // prints 0.25

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Tue, 16 Dec 2014 14:17:45 -0800 (PST)
Raw View
------=_Part_4275_974708114.1418768265987
Content-Type: multipart/alternative;
 boundary="----=_Part_4276_914012682.1418768265987"

------=_Part_4276_914012682.1418768265987
Content-Type: text/plain; charset=UTF-8


>
> Did you forget the inline before size_type above?


 Yes - my bad sorry the first example is:

template<typename T, size_t sz>
T & std::array::operator[]( inline size_type pos )

{
    static_assert( pos < sz, "invalid array index" );

    return this->operator[]((int)pos); //instance default 'non-inline'
(run-time) operator[] with 'a' casted (from 'inline int') to 'int'
}

So it overrides 'std::array::operator[]' for 'inline''s (or compiler known
constants).

I think the code above might be better written instead as:
>
>
> template<typename T, size_t sz>
> T &std::array<T,sz>::operator[](size_type pos)
> {
>         if (std::is_constexpr(pos))
>                 static_assert(pos < sz, "invalid index");
>
>         // call internal, private function
>         return this->_Internal_get(pos);
> }
>
> Where std::is_consteexpr is similar to the GCC builtin
> __builtin_constant_p,
> but ensures that the static_assert won't be tried if the condition failed.
>
> That syntax would also allow:
>
> constexpr uint32_t crc32(uint32 partial_crc32 uint64 data)
> {
>         if (!std::is_constexpr(partial_crc32, data)) {
>                 asm ("crc32 %1, %0" : "+r" (partial_crc32) : "r" (data));
>         } else {
>                 // inline, constexpr implementation of CRC32
>         }
>         return partial_crc32;
> }
>
> Why you may want to do that, you ask? Because the inline & constexpr
> implementation of CRC32 results in slower runtime code compared to the CPU
> instruction, but is required because the compiler doesn't know what the
> inline
> assembly does and is technically constexpr too.


In your example the compiler should execute each instance of 'crc32' which
it's not required to, he could just replace instances to the function into
an assembly 'call' to it's code (which will be strange one as it should
require additional compiler work). This reminds me that 'inline' functions
act the same way so adding 'inline' parameters or return-value to a
function will immediately require the compiler to evaluate it at each
instance, the same way as 'template''s are (so the functions won't be only
'inline'). But even this - I believe filtering your function request at
instance time is better then doing it in some 'if''s.

> auto SomeAlgo(inline bool bIsInline, typename( bIsInline ? inline int :
> int
> > ) n) -> decltype(n)
> > {
> >     //Do something with 'n' and return 'int' (or 'inline int')
> > }
> Whoa, whole new syntax here. You should probably send a proposal for the
> new
> syntax first, before we discuss inline variables.


Only a little - as I said 'inline' variables can be used instead of
templates, so this is equivalent to something like:

template<bool bIsInline, typename T = (bIsInline ? double : int)>
auto SomeAlgo(T n) -> decltype(n)

But this doesn't compile either for some strange reasons.

And when I hear "inline variables", by parallel with template variables, I
> somehow think of something like an automatically-updated variable:
>         int i;
>         inline int j = i * 4;                        // no warning
>         i = 4;
>         std::cout << j << endl;                // prints 16
>         i = 1;
>         std::cout << j << endl;                // prints 4
>         template<typename T> inline int fourth = i / T(4);
>         std::cout << fourth<int> << endl;        // prints 0
>         std::cout << fourth<float> << endl;        // prints 0.25


I believe this can be better implemented using a function.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4276_914012682.1418768265987
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); =
border-left-style: solid; padding-left: 1ex;">Did you forget the inline bef=
ore size_type above?</blockquote><div>&nbsp;</div>&nbsp;Yes - my bad sorry =
the first example is:<br><br><div class=3D"prettyprint" style=3D"border: 1p=
x solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(25=
0, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">template</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> size_t sz</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>T </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>array</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">operator</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">[](</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> size_type pos </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">static_assert</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> pos </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> sz</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">"inval=
id array index"</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbs=
p; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
return</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">this</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">[]((</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">pos</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettif=
y">//instance default 'non-inline' (run-time) operator[] with 'a' casted (f=
rom 'inline int') to 'int'</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">}</span></div></code></div><span style=3D"font-family: monospace;=
 color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"><br></span=
>So it overrides '<span class=3D"styled-by-prettify" style=3D"font-family: =
monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">std<=
/span><span class=3D"styled-by-prettify" style=3D"font-family: monospace; c=
olor: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">::</span><sp=
an class=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb=
(0, 0, 0); background-color: rgb(250, 250, 250);">array</span><span class=
=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102, 10=
2, 0); background-color: rgb(250, 250, 250);">::</span><span class=3D"style=
d-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 136); back=
ground-color: rgb(250, 250, 250);">operator</span><span class=3D"styled-by-=
prettify" style=3D"font-family: monospace; color: rgb(102, 102, 0); backgro=
und-color: rgb(250, 250, 250);">[]</span>' for 'inline''s (or compiler know=
n constants).<div><br></div><div><blockquote class=3D"gmail_quote" style=3D=
"margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(=
204, 204, 204); border-left-style: solid; padding-left: 1ex;">I think the c=
ode above might be better written instead as:<br> <br><br>template&lt;typen=
ame T, size_t sz&gt;<br> T &amp;std::array&lt;T,sz&gt;::operator[](size_typ=
e pos)<br> {<br> &nbsp; &nbsp; &nbsp; &nbsp; if (std::is_constexpr(pos))<br=
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; static_assert(pos=
 &lt; sz, "invalid index");<br> <br>&nbsp; &nbsp; &nbsp; &nbsp; // call int=
ernal, private function<br> &nbsp; &nbsp; &nbsp; &nbsp; return this-&gt;_In=
ternal_get(pos);<br> }<br> <br>Where std::is_consteexpr is similar to the G=
CC builtin __builtin_constant_p,<br> but ensures that the static_assert won=
't be tried if the condition failed.<br> <br>That syntax would also allow:<=
br> <br>constexpr uint32_t crc32(uint32 partial_crc32 uint64 data)<br> {<br=
> &nbsp; &nbsp; &nbsp; &nbsp; if (!std::is_constexpr(partial_crc32, data)) =
{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; asm ("crc32 %=
1, %0" : "+r" (partial_crc32) : "r" (data));<br> &nbsp; &nbsp; &nbsp; &nbsp=
; } else {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // i=
nline, constexpr implementation of CRC32<br> &nbsp; &nbsp; &nbsp; &nbsp; }<=
br> &nbsp; &nbsp; &nbsp; &nbsp; return partial_crc32;<br> }<br> <br>Why you=
 may want to do that, you ask? Because the inline &amp; constexpr<br> imple=
mentation of CRC32 results in slower runtime code compared to the CPU<br> i=
nstruction, but is required because the compiler doesn't know what the inli=
ne<br> assembly does and is technically constexpr too. </blockquote><br></d=
iv><div>In your example the compiler should execute each instance of 'crc32=
' which it's not required to, he could just replace instances to the functi=
on into an assembly 'call' to it's code (which will be strange one as it sh=
ould require additional compiler work). This reminds me that 'inline' funct=
ions act the same way so adding 'inline' parameters or return-value to a fu=
nction will immediately require the compiler to evaluate it at each instanc=
e, the same way as 'template''s are (so the functions won't be only 'inline=
'). But even this - I believe filtering your function request at instance t=
ime is better then doing it in some 'if''s.</div><div><br></div><div><block=
quote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left=
-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: soli=
d; padding-left: 1ex;">&gt; auto SomeAlgo(inline bool bIsInline, typename( =
bIsInline ? inline int : int&nbsp;<br>&gt; ) n) -&gt; decltype(n)&nbsp;<br>=
&gt; {&nbsp;<br>&gt; &nbsp; &nbsp; //Do something with 'n' and return 'int'=
 (or 'inline int')&nbsp;<br>&gt; }&nbsp;<br>Whoa, whole new syntax here. Yo=
u should probably send a proposal for the new&nbsp;<br>syntax first, before=
 we discuss inline variables.&nbsp;</blockquote></div><div><br></div><div>O=
nly a little - as I said 'inline' variables can be used instead of template=
s, so this is equivalent to something like:</div><div><br></div><div><div c=
lass=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wr=
ap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> bIsInline</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> T </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">bIsInline </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">?</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">double</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">)&gt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">SomeAlgo</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">T n</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">decltype</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">n</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></div></code></div><div><br></div></div><di=
v>But this doesn't compile either for some strange reasons.</div><div><br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; =
border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-=
style: solid; padding-left: 1ex;">And when I hear "inline variables", by pa=
rallel with template variables, I&nbsp;<br>somehow think of something like =
an automatically-updated variable:&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;int i;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;inline int j =3D i * 4;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;// no warning&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;i =3D 4;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;std::cout &lt;&lt; j &lt;&lt; endl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// prints=
 16&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i =3D 1;&nbsp;=
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; j &l=
t;&lt; endl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// prints 4&nbsp;<br>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;template&lt;typename T&gt; inline int fourth =3D=
 i / T(4);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::co=
ut &lt;&lt; fourth&lt;int&gt; &lt;&lt; endl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;// prints 0&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;std::cout &lt;&lt; fourth&lt;float&gt; &lt;&lt; endl;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// prints 0.25&nbsp;</blockquote><div>=
<br></div><div>I believe this can be better implemented using a function.</=
div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4276_914012682.1418768265987--
------=_Part_4275_974708114.1418768265987--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Tue, 16 Dec 2014 17:43:52 -0500
Raw View
--001a11c32cf4e8ec93050a5d174b
Content-Type: text/plain; charset=UTF-8

On Tue, Dec 16, 2014 at 1:50 PM, sasho648 <sasho648@mail.bg> wrote:
>
> Here is where 'inline' variables came in use. They can be initialized only
> once with another 'inline' variable or with literal but aren't 'const' and
> non-'inline' variables can't be casted to 'inline'. However the opposite is
> possible (casting from 'inline' to any other type). Functions declared with
> 'inline' parameters or return-value will be implicit 'inline' themselves.
> Instance to a function with argument literal will first search for one with
> parameter of type 'inline <type-of-literal>'. So now we could overload the
> 'std::array::operator[]' in order to do static checks on 'inline' variables
> like this (supposing that 'templates' are still used):
>
> template<typename T, size_t sz>
> T & std::array::operator[]( inline size_type pos )
>
> {
>     static_assert( pos < sz, "invalid array index" );
>
>     return this->operator[]((int)pos); //instance default 'non-inline'
> (run-time) operator[] with 'a' casted (from 'inline int') to 'int'
> }
>
>
>
Wouldn't 'constexpr' be the better keyword?  So you can write 2 versions of
the function - one for constexpr (compile-time) params, one for runtime
params.

Tony

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a11c32cf4e8ec93050a5d174b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Tue, Dec 16, 2014 at 1:50 PM, sasho648 <span dir=3D"ltr">&lt;<a href=
=3D"mailto:sasho648@mail.bg" target=3D"_blank">sasho648@mail.bg</a>&gt;</sp=
an> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr=
">Here is where &#39;inline&#39; variables came in use. They can be initial=
ized only once with another &#39;inline&#39; variable or with literal but a=
ren&#39;t &#39;const&#39; and non-&#39;inline&#39; variables can&#39;t be c=
asted to &#39;inline&#39;. However the opposite is possible (casting from &=
#39;inline&#39; to any other type). Functions declared with &#39;inline&#39=
; parameters or return-value will be implicit &#39;inline&#39; themselves. =
Instance to a function with argument literal will first search for one with=
 parameter of type &#39;inline &lt;type-of-literal&gt;&#39;. So now we coul=
d overload the &#39;std::array::operator[]&#39; in order to do static check=
s on &#39;inline&#39; variables like this (supposing that &#39;templates&#3=
9; are still used):<br><div><br></div><div style=3D"border:1px solid rgb(18=
7,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><code><d=
iv><span style=3D"color:rgb(0,0,136)">template</span><span style=3D"color:r=
gb(102,102,0)">&lt;</span><span style=3D"color:rgb(0,0,136)">typename</span=
><span style=3D"color:rgb(0,0,0)"> T</span><span style=3D"color:rgb(102,102=
,0)">,</span><span style=3D"color:rgb(0,0,0)"> size_t sz</span><span style=
=3D"color:rgb(102,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"><br>T=
 </span><span style=3D"color:rgb(102,102,0)">&amp;</span><span style=3D"col=
or:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">::</span><sp=
an style=3D"color:rgb(0,0,0)">array</span><span style=3D"color:rgb(102,102,=
0)">::</span><span style=3D"color:rgb(0,0,136)">operator</span><span style=
=3D"color:rgb(102,102,0)">[](</span><span style=3D"color:rgb(0,0,0)"> inlin=
e size_type pos </span><span style=3D"color:rgb(102,102,0)">)</span><span s=
tyle=3D"color:rgb(0,0,0)"><br><br></span><span style=3D"color:rgb(102,102,0=
)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:rgb(0,0,136)">static_assert</span><span style=3D"color:rgb(1=
02,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> pos </span><span style=
=3D"color:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(0,0,0)"> sz</=
span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(=
0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;invalid array inde=
x&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color=
:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:rgb(0,0,136)">return</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">this</span=
><span style=3D"color:rgb(102,102,0)">-&gt;</span><span style=3D"color:rgb(=
0,0,136)">operator</span><span style=3D"color:rgb(102,102,0)">[]((</span><s=
pan style=3D"color:rgb(0,0,136)">int</span><span style=3D"color:rgb(102,102=
,0)">)</span><span style=3D"color:rgb(0,0,0)">pos</span><span style=3D"colo=
r:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(136,0,0)">//instance default &#39;non-inline&#39; (run-ti=
me) operator[] with &#39;a&#39; casted (from &#39;inline int&#39;) to &#39;=
int&#39;</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"c=
olor:rgb(102,102,0)">}</span></div></code></div><div><span style=3D"line-he=
ight:14.08px;color:rgb(0,128,0);font-family:DejaVuSansMono,&quot;DejaVu San=
s Mono&quot;,courier,monospace;font-size:12.8px;white-space:nowrap"><br></s=
pan></div><div><span style=3D"line-height:14.08px;color:rgb(0,128,0);font-f=
amily:DejaVuSansMono,&quot;DejaVu Sans Mono&quot;,courier,monospace;font-si=
ze:12.8px;white-space:nowrap"><br></span></div></div></blockquote><div><br>=
</div><div>Wouldn&#39;t &#39;constexpr&#39; be the better keyword?=C2=A0 So=
 you can write 2 versions of the function - one for constexpr (compile-time=
) params, one for runtime params.<br><br></div><div>Tony<br></div><div><spa=
n class=3D""><font color=3D"#888888">
</font></span></div></div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c32cf4e8ec93050a5d174b--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 17 Dec 2014 00:45:41 +0200
Raw View
On 17 December 2014 at 00:43, Tony V E <tvaneerd@gmail.com> wrote:
>
>
> On Tue, Dec 16, 2014 at 1:50 PM, sasho648 <sasho648@mail.bg> wrote:
>>
>> Here is where 'inline' variables came in use. They can be initialized only
>> once with another 'inline' variable or with literal but aren't 'const' and
>> non-'inline' variables can't be casted to 'inline'. However the opposite is
>> possible (casting from 'inline' to any other type). Functions declared with
>> 'inline' parameters or return-value will be implicit 'inline' themselves.
>> Instance to a function with argument literal will first search for one with
>> parameter of type 'inline <type-of-literal>'. So now we could overload the
>> 'std::array::operator[]' in order to do static checks on 'inline' variables
>> like this (supposing that 'templates' are still used):
>>
>> template<typename T, size_t sz>
>> T & std::array::operator[]( inline size_type pos )
>>
>> {
>>     static_assert( pos < sz, "invalid array index" );
>>
>>     return this->operator[]((int)pos); //instance default 'non-inline'
>> (run-time) operator[] with 'a' casted (from 'inline int') to 'int'
>> }
>>
>>
>
> Wouldn't 'constexpr' be the better keyword?  So you can write 2 versions of
> the function - one for constexpr (compile-time) params, one for runtime
> params.


Good luck. constexpr as a function parameter specifier, and
suggestions to be able
to overload on constexpr, has been shot down every time that idea has
been floated.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Tue, 16 Dec 2014 14:57:31 -0800 (PST)
Raw View
------=_Part_4638_499013135.1418770651485
Content-Type: multipart/alternative;
 boundary="----=_Part_4639_990118410.1418770651485"

------=_Part_4639_990118410.1418770651485
Content-Type: text/plain; charset=UTF-8

@Tony V E

This doesn't matter - I'm just showing that ISO C++ standard introduces new
keywords like every-day - 'constexpr' is absolutely useless and as I just
showed it can be completely replaced with 'inline'. Even when I want to
declare that the 'return' value of a function will be inline (not the whole
function) I can still do it without using additional keywords like this:

int (inline Func)();

auto Func() -> inline int;


Those new keywords break compatibility very bad, if before 'C++ 11' this
was a valid expression:

int constexpr = 67 * 8;

Now it should report compiler error. Those fat asses there should get more
productive and doesn't introduce breaking-code new keywords for such bad
and not-well implemented ideas.

@Ville Voutilainen

Why - again is the fatness or something else?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4639_990118410.1418770651485
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>@<span class=3D"_username" style=3D"white-space: nowr=
ap;"><span class=3D"GJHURADP-B">Tony V E</span></span><span style=3D"white-=
space: nowrap;">&nbsp;</span></div><div><br></div>This doesn't matter - I'm=
 just showing that ISO C++ standard introduces new keywords like every-day =
- 'constexpr' is absolutely useless and as I just showed it can be complete=
ly replaced with 'inline'. Even when I want to declare that the 'return' va=
lue of a function will be inline (not the whole function) I can still do it=
 without using additional keywords like this:<br><br><div class=3D"prettypr=
int" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; =
background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Func</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">)();</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Func</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span></div></code></div><div><br><br>Th=
ose new keywords break compatibility very bad, if before 'C++ 11' this was =
a valid expression:<br><br><div class=3D"prettyprint" style=3D"border: 1px =
solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250,=
 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-b=
y-prettify">67</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #066;" class=3D"styled-by-prettify">8</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span></div></code></div><div>=
<br></div>Now it should report compiler error. Those fat asses there should=
 get more productive and doesn't introduce breaking-code new keywords for s=
uch bad and not-well implemented ideas.<br><br></div><div>@<span class=3D"_=
username" style=3D"white-space: nowrap;"><span class=3D"GJHURADP-B">Ville V=
outilainen</span></span><span style=3D"white-space: nowrap;">&nbsp;</span><=
/div><div><span style=3D"white-space: nowrap;"><br></span></div><div><span =
style=3D"white-space: nowrap;">Why - again is the fatness or something else=
?</span></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4639_990118410.1418770651485--
------=_Part_4638_499013135.1418770651485--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 17 Dec 2014 01:09:24 +0200
Raw View
On 17 December 2014 at 00:57, sasho648 <sasho648@mail.bg> wrote:
> @Tony V E
>
> This doesn't matter - I'm just showing that ISO C++ standard introduces new
> keywords like every-day - 'constexpr' is absolutely useless and as I just

Useless? It tells the user what to expect, it allows an implementation to know
when it's expected to evaluate at compile-time and when not.

> showed it can be completely replaced with 'inline'. Even when I want to

inline doesn't convey the same semantics.

> Those new keywords break compatibility very bad, if before 'C++ 11' this was
> a valid expression:
>
> int constexpr = 67 * 8;

"very bad"? How much code have you ever found that did that?

> Now it should report compiler error. Those fat asses there should get more
> productive and doesn't introduce breaking-code new keywords for such bad and
> not-well implemented ideas.

Well, I guess the "bad" and "not-well implemented" parts are debatable.

> Why - again is the fatness or something else?

As far as I can understand, constexpr function arguments would be against
the design of how constant expressions are to be evaluated. If you have
something productive to say about constexpr, feel free to write proposals
improving it. Otherwise I recommend minding your tone if you want to
be taken seriously.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Johannes Schaub <schaub.johannes@googlemail.com>
Date: Tue, 16 Dec 2014 23:14:57 +0000
Raw View
2014-12-16 22:57 GMT+00:00 sasho648 <sasho648@mail.bg>:
> @Tony V E
>
> This doesn't matter - I'm just showing that ISO C++ standard introduces new
> keywords like every-day - 'constexpr' is absolutely useless and as I just
> showed it can be completely replaced with 'inline'. Even when I want to
> declare that the 'return' value of a function will be inline (not the whole
> function) I can still do it without using additional keywords like this:
>
> int (inline Func)();
>
> auto Func() -> inline int;
>
>
> Those new keywords break compatibility very bad, if before 'C++ 11' this was
> a valid expression:
>
> int constexpr = 67 * 8;
>

Oh, the only real-world code that comes to mind that uses "constexpr"
in "incompatible" ways is my second example here:
http://stackoverflow.com/a/6473250/34509

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 17 Dec 2014 01:17:12 +0200
Raw View
On 17 December 2014 at 01:14, Johannes Schaub
<schaub.johannes@googlemail.com> wrote:
> Oh, the only real-world code that comes to mind that uses "constexpr"
> in "incompatible" ways is my second example here:
> http://stackoverflow.com/a/6473250/34509


No offense intended, Johannes, but I'm not QUITE sure whether that counts as
real-world code. :D

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: David Krauss <potswa@gmail.com>
Date: Wed, 17 Dec 2014 17:11:20 +0800
Raw View
--Apple-Mail=_EB6850ED-A8C7-4EE7-BE63-F604FC049A79
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2014=E2=80=9312=E2=80=9317, at 5:08 PM, sasho648 <sasho648@mail.bg> wr=
ote:
>=20
> int (inline Func)()
>=20
> auto Func() -> inline int
>=20
> Is equivalent to this:
>=20
> constexpr Func()

This may be the least sensible thing I=E2=80=99ve yet read on this list.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_EB6850ED-A8C7-4EE7-BE63-F604FC049A79
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=
=E2=80=9317, at 5:08 PM, sasho648 &lt;<a href=3D"mailto:sasho648@mail.bg" c=
lass=3D"">sasho648@mail.bg</a>&gt; wrote:</div><br class=3D"Apple-interchan=
ge-newline"><div class=3D""><div class=3D"prettyprint" style=3D"font-family=
: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; fon=
t-weight: normal; letter-spacing: normal; line-height: normal; orphans: aut=
o; text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; bo=
rder: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color=
: rgb(250, 250, 250);"><code class=3D"prettyprint"><span class=3D"styled-by=
-prettify" style=3D"color: rgb(0, 0, 136);">int</span>&nbsp;<span class=3D"=
styled-by-prettify" style=3D"color: rgb(102, 102, 0);">(</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">inline</span>&nbsp=
;<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 0, 102);">Func=
</span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);=
">)()</span><br class=3D""><br class=3D""><span class=3D"styled-by-prettify=
" style=3D"color: rgb(0, 0, 136);">auto</span>&nbsp;<span class=3D"styled-b=
y-prettify" style=3D"color: rgb(102, 0, 102);">Func</span><span class=3D"st=
yled-by-prettify" style=3D"color: rgb(102, 102, 0);">()</span>&nbsp;<span c=
lass=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">-&gt;</span>=
&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">i=
nline</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(0,=
 0, 136);">int</span></code></div><div style=3D"font-family: Helvetica; fon=
t-size: 12px; font-style: normal; font-variant: normal; font-weight: normal=
; letter-spacing: normal; line-height: normal; orphans: auto; text-align: s=
tart; text-indent: 0px; text-transform: none; white-space: normal; widows: =
auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""><br cl=
ass=3D""></div><div style=3D"font-family: Helvetica; font-size: 12px; font-=
style: normal; font-variant: normal; font-weight: normal; letter-spacing: n=
ormal; line-height: normal; orphans: auto; text-align: start; text-indent: =
0px; text-transform: none; white-space: normal; widows: auto; word-spacing:=
 0px; -webkit-text-stroke-width: 0px;" class=3D"">Is equivalent to this:<br=
 class=3D""><br class=3D""><div class=3D"prettyprint" style=3D"border: 1px =
solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250,=
 250, 250);"><code class=3D"prettyprint"><span class=3D"styled-by-prettify"=
 style=3D"color: rgb(0, 0, 136);">constexpr</span>&nbsp;<span class=3D"styl=
ed-by-prettify" style=3D"color: rgb(102, 0, 102);">Func</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">()</span></code>=
</div></div></div></blockquote></div><br class=3D""><div class=3D"">This ma=
y be the least sensible thing I=E2=80=99ve yet read on this list.</div></bo=
dy></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_EB6850ED-A8C7-4EE7-BE63-F604FC049A79--

.


Author: sasho648 <sasho648@mail.bg>
Date: Wed, 17 Dec 2014 01:08:25 -0800 (PST)
Raw View
------=_Part_4581_128453863.1418807305351
Content-Type: multipart/alternative;
 boundary="----=_Part_4582_703010206.1418807305351"

------=_Part_4582_703010206.1418807305351
Content-Type: text/plain; charset=UTF-8


>
> Useless? It tells the user what to expect, it allows an implementation to
> know
> when it's expected to evaluate at compile-time and when not.


The same way as 'inline' could tell but not for the whole function, making
things ugly - instead for the return-value or the parameters without
introducing new keyword. Here is how 'constexpr'  function can be simulated
to do the exact same thing:

int (inline Func)()

auto Func() -> inline int

Is equivalent to this:

constexpr Func()

"very bad"? How much code have you ever found that did that?


Who know - it's not something that can't come into mind to write. But as we
have a choice - why introduce new keywords instead of recycling old-ones
and giving us so limited-functionality with it?

Well, I guess the "bad" and "not-well implemented" parts are debatable.


Let's debate them then. I just showed why 'constexpr''s are not-well
implemented by my first post examples (automated static checks, explicit
optimizations and inline references).

As far as I can understand, constexpr function arguments would be against
> the design of how constant expressions are to be evaluated. If you have
> something productive to say about constexpr, feel free to write proposals
> improving it. Otherwise I recommend minding your tone if you want to
> be taken seriously.


Sorry then - that I called what is obvious. How can you introduce a
new-keyword only to say that some functions MAY be evaluated at run-time
and not implement natural things which everyone who have ever heard of
'constexpr' have tried without a luck? And what is this thing that is
against my proposal - can someone name it more clearly?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4582_703010206.1418807305351
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); =
border-left-style: solid; padding-left: 1ex;">Useless? It tells the user wh=
at to expect, it allows an implementation to know&nbsp;<br>when it's expect=
ed to evaluate at compile-time and when not.&nbsp;</blockquote><div><br></d=
iv><div>The same way as 'inline' could tell but not for the whole function,=
 making things ugly - instead for the return-value or the parameters withou=
t introducing new keyword. Here is how 'constexpr' &nbsp;function can be si=
mulated to do the exact same thing:<br><br></div><div class=3D"prettyprint"=
 style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; back=
ground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Func</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">)()</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Func</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">int</span></div></code></div><div><br></=
div><div>Is equivalent to this:<br><br><div class=3D"prettyprint" style=3D"=
border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-col=
or: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Func</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">()</span></div></code></d=
iv><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); bord=
er-left-style: solid; padding-left: 1ex;">"very bad"? How much code have yo=
u ever found that did that?&nbsp;</blockquote><div><br></div><div>Who know =
- it's not something that can't come into mind to write. But as we have a c=
hoice - why introduce new keywords instead of recycling old-ones and giving=
 us so limited-functionality with it?</div><div><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1px=
; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-=
left: 1ex;">Well, I guess the "bad" and "not-well implemented" parts are de=
batable.&nbsp;</blockquote><div><br></div><div>Let's debate them then. I ju=
st showed why 'constexpr''s are not-well implemented by my first post examp=
les (automated static checks, explicit optimizations and inline references)=
..</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 2=
04); border-left-style: solid; padding-left: 1ex;">As far as I can understa=
nd, constexpr function arguments would be against&nbsp;<br>the design of ho=
w constant expressions are to be evaluated. If you have&nbsp;<br>something =
productive to say about constexpr, feel free to write proposals&nbsp;<br>im=
proving it. Otherwise I recommend minding your tone if you want to&nbsp;<br=
>be taken seriously.&nbsp;</blockquote><div><br></div><div>Sorry then - tha=
t I called what is obvious. How can you introduce a new-keyword only to say=
 that some functions MAY be evaluated at run-time and not implement natural=
 things which everyone who have ever heard of 'constexpr' have tried withou=
t a luck? And what is this thing that is against my proposal - can someone =
name it more clearly?</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4582_703010206.1418807305351--
------=_Part_4581_128453863.1418807305351--

.


Author: sasho648 <sasho648@mail.bg>
Date: Wed, 17 Dec 2014 01:15:01 -0800 (PST)
Raw View
------=_Part_4568_1945487314.1418807701631
Content-Type: multipart/alternative;
 boundary="----=_Part_4569_219277176.1418807701631"

------=_Part_4569_219277176.1418807701631
Content-Type: text/plain; charset=UTF-8


>
> Useless? It tells the user what to expect, it allows an implementation to
> know
> when it's expected to evaluate at compile-time and when not.


The same way as 'inline' could tell but not for the whole function, making
things ugly - instead separately for the return-value or the parameters
without introducing new keyword. Here is how 'constexpr'  function can be
simulated to do the exact same thing:

int (inline Func)()

auto Func() -> inline int

Is equivalent to this:

constexpr Func()

"very bad"? How much code have you ever found that did that?


Who knows - it's not something that can't be written. But as we have a
choice - why introduce new keywords instead of recycling old-ones?

Well, I guess the "bad" and "not-well implemented" parts are debatable.


Let's debate them then. I just showed why 'constexpr''s are not-well
implemented by my first post examples which shows some of their limits
(automated static checks, explicit optimizations and inline references).

As far as I can understand, constexpr function arguments would be against
> the design of how constant expressions are to be evaluated. If you have
> something productive to say about constexpr, feel free to write proposals
> improving it. Otherwise I recommend minding your tone if you want to
> be taken seriously.


Sorry then - that I called what is obvious. How can you introduce a
new-keyword only to say that some functions MAY be evaluated at run-time
and not implement natural things which everyone who have ever heard of
'constexpr' have tried without a luck? And what is this thing against my
proposal - can someone name it more clearly?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4569_219277176.1418807701631
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"GJHURADG5D"><div tabindex=3D"0" class=3D"GJH=
URADDJB"><div style=3D"overflow: auto;"><div dir=3D"ltr"><div class=3D"GJHU=
RADPKB"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8e=
x; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-le=
ft-style: solid; padding-left: 1ex;">Useless? It tells the user what to exp=
ect, it allows an implementation to know&nbsp;<br>when it's expected to eva=
luate at compile-time and when not.&nbsp;</blockquote><div><br></div></div>=
<div>The same way as 'inline' could tell but not for the whole function, ma=
king things ugly - instead separately for the return-value or the parameter=
s without introducing new keyword. Here is how 'constexpr' &nbsp;function c=
an be simulated to do the exact same thing:<br><br></div><div class=3D"GJHU=
RADPKB"><div style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: brea=
k-word; background-color: rgb(250, 250, 250);"><code><span style=3D"color: =
rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</spa=
n><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rg=
b(0, 0, 136);">inline</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</sp=
an><span style=3D"color: rgb(102, 0, 102);">Func</span><span style=3D"color=
: rgb(102, 102, 0);">)()</span><span style=3D"color: rgb(0, 0, 0);"><br><br=
></span><span style=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"co=
lor: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color: rgb(102, 0, 102);">F=
unc</span><span style=3D"color: rgb(102, 102, 0);">()</span><span style=3D"=
color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color: rgb(102, 102, 0);"=
>-&gt;</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=
=3D"color: rgb(0, 0, 136);">inline</span><span style=3D"color: rgb(0, 0, 0)=
;">&nbsp;</span><span style=3D"color: rgb(0, 0, 136);">int</span></code></d=
iv><div><br></div></div><div>Is equivalent to this:<br><br><div style=3D"bo=
rder: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color=
: rgb(250, 250, 250);"><code><span style=3D"color: rgb(0, 0, 136);">constex=
pr</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"c=
olor: rgb(102, 0, 102);">Func</span><span style=3D"color: rgb(102, 102, 0);=
">()</span></code></div><br></div><div class=3D"GJHURADPKB"><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1=
px; border-left-color: rgb(204, 204, 204); border-left-style: solid; paddin=
g-left: 1ex;">"very bad"? How much code have you ever found that did that?&=
nbsp;</blockquote><div><br></div></div><div>Who knows - it's not something =
that can't be written. But as we have a choice - why introduce new keywords=
 instead of recycling old-ones?</div><div class=3D"GJHURADPKB"><div><br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; bo=
rder-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-st=
yle: solid; padding-left: 1ex;">Well, I guess the "bad" and "not-well imple=
mented" parts are debatable.&nbsp;</blockquote><div><br></div></div><div>Le=
t's debate them then. I just showed why 'constexpr''s are not-well implemen=
ted by my first post examples which shows some of their limits (automated s=
tatic checks, explicit optimizations and inline references).</div><div clas=
s=3D"GJHURADPKB"><div><br></div><blockquote class=3D"gmail_quote" style=3D"=
margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(2=
04, 204, 204); border-left-style: solid; padding-left: 1ex;">As far as I ca=
n understand, constexpr function arguments would be against&nbsp;<br>the de=
sign of how constant expressions are to be evaluated. If you have&nbsp;<br>=
something productive to say about constexpr, feel free to write proposals&n=
bsp;<br>improving it. Otherwise I recommend minding your tone if you want t=
o&nbsp;<br>be taken seriously.&nbsp;</blockquote><div><br></div></div><div>=
Sorry then - that I called what is obvious. How can you introduce a new-key=
word only to say that some functions MAY be evaluated at run-time and not i=
mplement natural things which everyone who have ever heard of 'constexpr' h=
ave tried without a luck? And what is this thing against my proposal - can =
someone name it more clearly?</div></div></div></div><div></div><div></div>=
</div><div><div class=3D"GJHURADG5D"></div></div><div class=3D"GJHURADLGB">=
<div class=3D"GJHURADKGB GJHURADAKB"></div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4569_219277176.1418807701631--
------=_Part_4568_1945487314.1418807701631--

.


Author: sasho648 <sasho648@mail.bg>
Date: Wed, 17 Dec 2014 01:20:13 -0800 (PST)
Raw View
------=_Part_107_835793772.1418808013448
Content-Type: multipart/alternative;
 boundary="----=_Part_108_495390977.1418808013448"

------=_Part_108_495390977.1418808013448
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

17 =D0=B4=D0=B5=D0=BA=D0=B5=D0=BC=D0=B2=D1=80=D0=B8 2014, =D1=81=D1=80=D1=
=8F=D0=B4=D0=B0, 11:11:25 UTC+2, David Krauss =D0=BD=D0=B0=D0=BF=D0=B8=D1=
=81=D0=B0:
>
>
> On 2014=E2=80=9312=E2=80=9317, at 5:08 PM, sasho648 <sash...@mail.bg <jav=
ascript:>> wrote:
>
> int (inline Func)()
>
> auto Func() -> inline int
>
> Is equivalent to this:
>
> constexpr Func()
>
>
> This may be the least sensible thing I=E2=80=99ve yet read on this list.
>

The declaration is needed to be so complex, because the use of 'inline'=20
before the function is reserved for 'inline' functions. However for the=20
case you may use type aliases the same way you do for functions returning=
=20
array references or pointers. Example:

using FuncReturnType =3D inline int;

FuncReturnType Func();


--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_108_495390977.1418808013448
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">17 =D0=B4=D0=B5=D0=BA=D0=B5=D0=BC=D0=B2=D1=80=D0=B8 2014, =
=D1=81=D1=80=D1=8F=D0=B4=D0=B0, 11:11:25 UTC+2, David Krauss =D0=BD=D0=B0=
=D0=BF=D0=B8=D1=81=D0=B0:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
style=3D"word-wrap:break-word"><br><div><blockquote type=3D"cite"><div>On 2=
014=E2=80=9312=E2=80=9317, at 5:08 PM, sasho648 &lt;<a href=3D"javascript:"=
 target=3D"_blank" gdf-obfuscated-mailto=3D"t114IDI86NsJ" onmousedown=3D"th=
is.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';=
return true;">sash...@mail.bg</a>&gt; wrote:</div><br><div><div style=3D"fo=
nt-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;fo=
nt-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;=
text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;bor=
der:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(25=
0,250,250)"><code><span style=3D"color:rgb(0,0,136)">int</span>&nbsp;<span =
style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,136)">i=
nline</span>&nbsp;<span style=3D"color:rgb(102,0,102)">Func</span><span sty=
le=3D"color:rgb(102,102,0)">)()</span><br><br><span style=3D"color:rgb(0,0,=
136)">auto</span>&nbsp;<span style=3D"color:rgb(102,0,102)">Func</span><spa=
n style=3D"color:rgb(102,102,0)">()</span>&nbsp;<span style=3D"color:rgb(10=
2,102,0)">-&gt;</span>&nbsp;<span style=3D"color:rgb(0,0,136)">inline</span=
>&nbsp;<span style=3D"color:rgb(0,0,136)">int</span></code></div><div style=
=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant:nor=
mal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:=
start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0=
px"><br></div><div style=3D"font-family:Helvetica;font-size:12px;font-style=
:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-h=
eight:normal;text-align:start;text-indent:0px;text-transform:none;white-spa=
ce:normal;word-spacing:0px">Is equivalent to this:<br><br><div style=3D"bor=
der:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(25=
0,250,250)"><code><span style=3D"color:rgb(0,0,136)">constexpr</span>&nbsp;=
<span style=3D"color:rgb(102,0,102)">Func</span><span style=3D"color:rgb(10=
2,102,0)">()</span></code></div></div></div></blockquote></div><br><div>Thi=
s may be the least sensible thing I=E2=80=99ve yet read on this list.</div>=
</div></blockquote><div><br></div><div>The declaration is needed to be so c=
omplex, because the use of 'inline' before the function is reserved for 'in=
line' functions. However for the case you may use type aliases the same way=
 you do for functions returning array references or pointers. Example:<br><=
br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">FuncReturnType</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">FuncReturnType</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Func</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">();</span></div></code></div><div><br><=
br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_108_495390977.1418808013448--
------=_Part_107_835793772.1418808013448--

.


Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Wed, 17 Dec 2014 06:25:23 -0800 (PST)
Raw View
------=_Part_416_1204189752.1418826323071
Content-Type: multipart/alternative;
 boundary="----=_Part_417_931272536.1418826323071"

------=_Part_417_931272536.1418826323071
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable


On Tuesday, 16 December 2014 18:50:46 UTC, sasho648 wrote:
>
> As the title says - I'm purposing the introduction of a new variables=20
> specifier - 'inline', which will indicate that their value is known at=20
> compile-time. [Literals aren't itself 'inline' variables, so an reference=
=20
> to 'inline' variable can't bound to literal.] The motivation of introduci=
ng=20
> it is enabling static checks at functions, native 'read-only public' clas=
s=20
> member specifiers and creating more optimized code.
>
> Example of the first one can be given by using 'std::array' if we access=
=20
> an object of the type using the 'operator[]' and 'constexpr' with invalid=
=20
> index no compiler warning or even an error will be introduced:
>
>    =20
> array<int, 5> arr;
>    =20
> cout << arr[98] << endl; //compiles just fine
>
> Life example <http://melpon.org/wandbox/permlink/6AUCctBG2H1gYwXq>.
>
> You'll say - this is too obvious - no one will do such thing but let's=20
> imagine that we are going to access the array element, instead of a=20
> literal, by some constexpr function.
>
> constexpr int EvaluateSpecialArrayIndex(int a)
> { return a * sizeof(int); }
>
> cout << arr[EvaluateSpecialArrayIndex(4)] << endl;
>
> Now things get complex, huh? In order to check if the array index is vali=
d=20
> we should first multiply by hand 4 * sizeof(int) and compare it with the=
=20
> array size. You think now - hey but why don't you add a static_assert in=
=20
> the 'EvaluateSpecialArrayIndex' and check 'a' with the array size. But th=
e=20
> truth is - that you can't do that as the parameter 'a' isn't required to =
be=20
> 'constexpr', neither the return value of the function. Example on valid=
=20
> 'constexpr' call with 'lvalue':
>
>
> int a =3D rand() % 4; //lvalue
>
> cout << arr[EvaluateSpecialArrayIndex(a)] << endl; // also valid
>
> Life example <http://melpon.org/wandbox/permlink/DLuQZd1ECewZkpxQ>.
>
> So this piece of code is invalid:
>
> constexpr int EvaluateSpecialArrayIndex(int a)
> { static_assert( a < 5, "invalid a" ); return a * sizeof(int); }
>
>
> Life example <http://melpon.org/wandbox/permlink/z9uxsbpr9irk2LBR>.
>
> Here is where 'inline' variables came in use. They can be initialized onl=
y=20
> once with another 'inline' variable or with literal but aren't 'const' an=
d=20
> non-'inline' variables can't be casted to 'inline'. However the opposite =
is=20
> possible (casting from 'inline' to any other type). Functions declared wi=
th=20
> 'inline' parameters or return-value will be implicit 'inline' themselves.=
=20
> Instance to a function with argument literal will first search for one wi=
th=20
> parameter of type 'inline <type-of-literal>'. So now we could overload th=
e=20
> 'std::array::operator[]' in order to do static checks on 'inline' variabl=
es=20
> like this (supposing that 'templates' are still used):
>
> template<typename T, size_t sz>
> T & std::array::operator[]( size_type pos )
>
> {
>     static_assert( pos < sz, "invalid array index" );
>
>     return this->operator[]((int)pos); //instance default 'non-inline'=20
> (run-time) operator[] with 'a' casted (from 'inline int') to 'int'
> }
>
>
> By using the above function this invalid code:
>
> array<int, 5> arr;
>    =20
> cout << arr[98] << endl;
>
> Will report compiler error, instead of producing undefined behavior.
>
> The other usage of the specifier, optimizing code, can be demonstrated by=
=20
> creating one general function - for both 'inline' and 'non-inline'=20
> parameters, of certain algorithm and other 2 for 'inline' and 'non-inline=
'=20
> which will specialize it, so when you call it with for example literal - =
it=20
> will be evaluated at compile-time and when you do with some variable it=
=20
> will create code for run-time execution. Example:
>
> auto SomeAlgo(inline bool bIsInline, typename( bIsInline ? inline int :=
=20
> int ) n) -> decltype(n)
> {
>     //Do something with 'n' and return 'int' (or 'inline int')
> }
> =20
>
inline int SomeAlgo(inline int a) { static_assert( a < 0, "invalid a" );=20
> return SomeAlgo(true, a); }
>
> int SomeAlgo(int a) { return SomeAlgo(false, a); }
>
> *Note that the first function is declared as returning an 'inline int', i=
f=20
> it was the function itself to be 'inline', it should be 'int inline=20
> SomeAlgo', which is an inline function returning 'int'.*
>
> And some example instances of 'SomeAlgo':
>
> SomeAlgo(rand()); //it will invoke code creation as 'rand()' doesn't=20
> return 'inline' value
>
> SomeAlgo(9); //Will evaluate at compile-time as literal '9' can be used=
=20
> to initialize 'inline' variables
>
> Another useful feature will be the use of 'inline references' which are=
=20
> such that will point at some compiler-known location (nothing special),=
=20
> they'll be useful when you want to create a public const reference to som=
e=20
> private member in order to allow public read-only access to it. For now w=
e=20
> could only write this:
>
> class A
> {
>     int _a;
>
> public:
>
>     const int &a =3D _a;
> } ;
>
> Life example <http://melpon.org/wandbox/permlink/2Ffi7NKWf86cmcQ6>.
>
> But in the case memory for 'a' will be allocated for each 'A' instance,=
=20
> which is not a deal. We couldn't write this with 'constexpr' for some=20
> strange reason:
>
> class A
> {
>     int _a;
>
> public:
>
>     constexpr int &a =3D _a; // the same as 'const int & constexpr a' -=
=20
> still produces error
> } ;
>
> Life example <http://melpon.org/wandbox/permlink/fGWsVP2bcqhG3zBa>.
>
> By using our new construct this could write this:
>
> class A
> {
>     int _a;
>
> public:
>
>     const int & inline a =3D _a; // inline reference to '_a'
> } ;
>
> Which basically means that each reference to 'a', will be evaluated like =
-=20
> '(const int)_a', so no additional memory will be created now.
>
> Function specialization will be done to functions with 'inline'=20
> parameters, which when receive argument values will search for a function=
=20
> which have specialized them. The parameter specialization will be done vi=
a=20
> the '=3D=3D' operator (one specialization can be for multiples values). E=
xamples
>
> auto FuncAdd(inline typename T, T a, T b) -> T //general function
> {
>     return a + b;
> }
>
> auto FuncAdd(inline typename T =3D=3D int, T a, T b) -> T //specialized=
=20
> function about the 'T' parameter, as no inline params, no implicit 'inlin=
e'=20
> conversion
> {
>     cout << "I can deal with int" << endl;
>
>     return a + b;
> }
>
> Am I to understand the =E2=80=9Cinline typename T=E2=80=9D as an alternat=
ive method of=20
expressing templates or one function that will work for any type?
=20
Firstly, whether or not you want this as a template replacement, I object=
=20
to having to specify the type when the compiler can deduce that from the=20
variables.
=20
If it is meant as a replacement for a template, having the type as a=20
parameter is confusing=E2=80=A6 I would expect one function, and only one f=
unction,=20
to be substantiated when a function is not explicitly templated.
=20
If it is not, I am at a loss as to how a compiler is meant to implement it=
=20
efficiently (or at all, if it is defined in a separate TU).
=20
Regarding the second (overloaded) function, is that supposed to overload on=
=20
type int?  If so, =E2=80=9Cauto FuncAdd(int, =E2=80=A6=E2=80=9D would be mo=
re in line with current=20
practice.  This will not create an ambiguity, as the parameter is already=
=20
defined as a typename.
=20

> And some 'FuncAdd' instances:
>
> FuncAdd(int, 9, 5); // 'FuncAdd' int specialization called (of type -=20
> 'auto (inline typename T =3D=3D int, T a, T b) -> T')
>
> FuncAdd(double, 3.14f, 1); // 'FuncAdd' general called (of type - 'auto=
=20
> (inline typename T, T a, T b) -> T')
>
>
> Some additional 'inline' specifier rules connected to specialization and=
=20
> classes. A class can have special methods for 'inline' instances of it,=
=20
> which are defined by specifiying 'inline' after it's declaration (in such=
=20
> methods 'this' will be inline pointer and will point to an sequenced=20
> 'inline'  array holding it's inline member objects). Inline instances of=
=20
> class will instance only it's special 'inline-this' methods and won't=20
> create any memory for it's non-inline members. Classes can't be specializ=
ed=20
> but you can create a derived class which specialize their methods. But th=
is=20
> could cha
> ...

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_417_931272536.1418826323071
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br>On Tuesday, 16 December 2014 18:50:46 UTC, sasho648  w=
rote:<blockquote style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;" class=3D"gmail_quote"><div dir=3D"ltr">As the title says - I'm =
purposing the introduction of a new variables specifier - 'inline', which w=
ill indicate that their value is known at compile-time. [Literals aren't it=
self 'inline' variables, so an reference to 'inline' variable can't bound t=
o literal.] The motivation of introducing it is enabling static checks at f=
unctions, native 'read-only public' class member specifiers and creating mo=
re optimized code.<br><br>Example of the first one can be given by using 's=
td::array' if we access an object of the type using the 'operator[]' and 'c=
onstexpr' with invalid index no compiler warning or even an error will be i=
ntroduced:<br><br><div>&nbsp; &nbsp;&nbsp;</div><div style=3D"border: 1px s=
olid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, =
250, 250);"><code><div><span style=3D"color: rgb(0, 0, 0);">array</span><sp=
an style=3D"color: rgb(102, 102, 0);">&lt;</span><span style=3D"color: rgb(=
0, 0, 136);">int</span><span style=3D"color: rgb(102, 102, 0);">,</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102,=
 102);">5</span><span style=3D"color: rgb(102, 102, 0);">&gt;</span><span s=
tyle=3D"color: rgb(0, 0, 0);"> arr</span><span style=3D"color: rgb(102, 102=
, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; <br>c=
out </span><span style=3D"color: rgb(102, 102, 0);">&lt;&lt;</span><span st=
yle=3D"color: rgb(0, 0, 0);"> arr</span><span style=3D"color: rgb(102, 102,=
 0);">[</span><span style=3D"color: rgb(0, 102, 102);">98</span><span style=
=3D"color: rgb(102, 102, 0);">]</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(102, 102, 0);">&lt;&lt;</span><span style=
=3D"color: rgb(0, 0, 0);"> endl</span><span style=3D"color: rgb(102, 102, 0=
);">;</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"col=
or: rgb(136, 0, 0);">//compiles just fine</span></div></code></div><div><br=
></div><div>Life <a onmousedown=3D"this.href=3D'http://www.google.com/url?q=
\75http%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2F6AUCctBG2H1gYwXq\46sa\75D=
\46sntz\0751\46usg\75AFQjCNEHGAWmo00ulsU7ElO2plX9RLoM8w';return true;" oncl=
ick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fmelpon.org%2=
Fwandbox%2Fpermlink%2F6AUCctBG2H1gYwXq\46sa\75D\46sntz\0751\46usg\75AFQjCNE=
HGAWmo00ulsU7ElO2plX9RLoM8w';return true;" href=3D"http://melpon.org/wandbo=
x/permlink/6AUCctBG2H1gYwXq" target=3D"_blank">example</a>.</div><div><br><=
/div><div>You'll say - this is too obvious - no one will do such thing but =
let's imagine that we are going to access the array element, instead of a l=
iteral, by some constexpr function.<br><br><div></div></div><div style=3D"b=
order: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-colo=
r: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);">c=
onstexpr</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"=
color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);"> </s=
pan><span style=3D"color: rgb(102, 0, 102);">EvaluateSpecialArrayIndex</spa=
n><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rg=
b(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);"> a</span><spa=
n style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0=
, 0);"><br></span><span style=3D"color: rgb(102, 102, 0);">{</span><span st=
yle=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);"=
>return</span><span style=3D"color: rgb(0, 0, 0);"> a </span><span style=3D=
"color: rgb(102, 102, 0);">*</span><span style=3D"color: rgb(0, 0, 0);"> </=
span><span style=3D"color: rgb(0, 0, 136);">sizeof</span><span style=3D"col=
or: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">int</=
span><span style=3D"color: rgb(102, 102, 0);">);</span><span style=3D"color=
: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">}</span><=
span style=3D"color: rgb(0, 0, 0);"><br><br>cout </span><span style=3D"colo=
r: rgb(102, 102, 0);">&lt;&lt;</span><span style=3D"color: rgb(0, 0, 0);"> =
arr</span><span style=3D"color: rgb(102, 102, 0);">[</span><span style=3D"c=
olor: rgb(102, 0, 102);">EvaluateSpecialArrayIndex</span><span style=3D"col=
or: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 102, 102);"><wb=
r>4</span><span style=3D"color: rgb(102, 102, 0);">)]</span><span style=3D"=
color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">&lt;=
&lt;</span><span style=3D"color: rgb(0, 0, 0);"> endl</span><span style=3D"=
color: rgb(102, 102, 0);">;</span></div></code></div><div><br>Now things ge=
t complex, huh? In order to check if the array index is valid we should fir=
st multiply by hand 4 * sizeof(int) and compare it with the array size. You=
 think now - hey but why don't you add a static_assert in the 'EvaluateSpec=
ialArrayIndex' and check 'a' with the array size. But the truth is - that y=
ou can't do that as the parameter 'a' isn't required to be 'constexpr', nei=
ther the return value of the function. Example on valid 'constexpr' call wi=
th 'lvalue':<br></div><div><br></div><div><br></div><div><div style=3D"bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: =
rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);">int<=
/span><span style=3D"color: rgb(0, 0, 0);"> a </span><span style=3D"color: =
rgb(102, 102, 0);">=3D</span><span style=3D"color: rgb(0, 0, 0);"> rand</sp=
an><span style=3D"color: rgb(102, 102, 0);">()</span><span style=3D"color: =
rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">%</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102,=
 102);">4</span><span style=3D"color: rgb(102, 102, 0);">;</span><span styl=
e=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">/=
/lvalue</span><span style=3D"color: rgb(0, 0, 0);"><br><br>cout </span><spa=
n style=3D"color: rgb(102, 102, 0);">&lt;&lt;</span><span style=3D"color: r=
gb(0, 0, 0);"> arr</span><span style=3D"color: rgb(102, 102, 0);">[</span><=
span style=3D"color: rgb(102, 0, 102);">EvaluateSpecialArrayIndex</span><sp=
an style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, =
0, 0);"><wbr>a</span><span style=3D"color: rgb(102, 102, 0);">)]</span><spa=
n style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102=
, 0);">&lt;&lt;</span><span style=3D"color: rgb(0, 0, 0);"> endl</span><spa=
n style=3D"color: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0=
, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">// also valid</span><=
/div></code></div><span style=3D"color: rgb(102, 102, 0); font-family: mono=
space; background-color: rgb(250, 250, 250);"><br></span>Life <a onmousedow=
n=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fmelpon.org%2Fw=
andbox%2Fpermlink%2FDLuQZd1ECewZkpxQ\46sa\75D\46sntz\0751\46usg\75AFQjCNEm_=
uIBkPSzkfBrS4_OzIA6qs4zVA';return true;" onclick=3D"this.href=3D'http://www=
..google.com/url?q\75http%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FDLuQZd1E=
CewZkpxQ\46sa\75D\46sntz\0751\46usg\75AFQjCNEm_uIBkPSzkfBrS4_OzIA6qs4zVA';r=
eturn true;" href=3D"http://melpon.org/wandbox/permlink/DLuQZd1ECewZkpxQ" t=
arget=3D"_blank">example</a>.<br><br></div><div>So this piece of code is in=
valid:</div><div><br></div><div><div style=3D"border: 1px solid rgb(187, 18=
7, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><cod=
e><div><span style=3D"color: rgb(0, 0, 136);">constexpr</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">in=
t</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: =
rgb(102, 0, 102);">EvaluateSpecialArrayIndex</span><span style=3D"color: rg=
b(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">int</span><=
span style=3D"color: rgb(0, 0, 0);"> a</span><span style=3D"color: rgb(102,=
 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"><br></span><span st=
yle=3D"color: rgb(102, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0)=
;"> </span><span style=3D"color: rgb(0, 0, 136);">static_assert</span><span=
 style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0,=
 0);"> a </span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span s=
tyle=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102=
);">5</span><span style=3D"color: rgb(102, 102, 0);">,</span><span style=3D=
"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 136, 0);">"inva=
lid a"</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"co=
lor: rgb(102, 102, 0);">);</span><span style=3D"color: rgb(0, 0, 0);"> </sp=
an><span style=3D"color: rgb(0, 0, 136);">return</span><span style=3D"color=
: rgb(0, 0, 0);"> a </span><span style=3D"color: rgb(102, 102, 0);">*</span=
><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, =
0, 136);">sizeof</span><span style=3D"color: rgb(102, 102, 0);">(</span><sp=
an style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(102=
, 102, 0);">);</span><span style=3D"color: rgb(0, 0, 0);"> </span><span sty=
le=3D"color: rgb(102, 102, 0);">}</span></div></code></div><div><br></div><=
br>Life <a onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3=
A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2Fz9uxsbpr9irk2LBR\46sa\75D\46sntz\0=
751\46usg\75AFQjCNFx20arc619usjmJ92iPdS3wLwRYA';return true;" onclick=3D"th=
is.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fmelpon.org%2Fwandbox%=
2Fpermlink%2Fz9uxsbpr9irk2LBR\46sa\75D\46sntz\0751\46usg\75AFQjCNFx20arc619=
usjmJ92iPdS3wLwRYA';return true;" href=3D"http://melpon.org/wandbox/permlin=
k/z9uxsbpr9irk2LBR" target=3D"_blank">example</a>.</div><div><br></div><div=
>Here is where 'inline' variables came in use. They can be initialized only=
 once with another 'inline' variable or with literal but aren't 'const' and=
 non-'inline' variables can't be casted to 'inline'. However the opposite i=
s possible (casting from 'inline' to any other type). Functions declared wi=
th 'inline' parameters or return-value will be implicit 'inline' themselves=
.. Instance to a function with argument literal will first search for one wi=
th parameter of type 'inline &lt;type-of-literal&gt;'. So now we could over=
load the 'std::array::operator[]' in order to do static checks on 'inline' =
variables like this (supposing that 'templates' are still used):<br><br></d=
iv><div style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-wor=
d; background-color: rgb(250, 250, 250);"><code><div><span style=3D"color: =
rgb(0, 0, 136);">template</span><span style=3D"color: rgb(102, 102, 0);">&l=
t;</span><span style=3D"color: rgb(0, 0, 136);">typename</span><span style=
=3D"color: rgb(0, 0, 0);"> T</span><span style=3D"color: rgb(102, 102, 0);"=
>,</span><span style=3D"color: rgb(0, 0, 0);"> size_t sz</span><span style=
=3D"color: rgb(102, 102, 0);">&gt;</span><span style=3D"color: rgb(0, 0, 0)=
;"><br>T </span><span style=3D"color: rgb(102, 102, 0);">&amp;</span><span =
style=3D"color: rgb(0, 0, 0);"> std</span><span style=3D"color: rgb(102, 10=
2, 0);">::</span><span style=3D"color: rgb(0, 0, 0);">array</span><span sty=
le=3D"color: rgb(102, 102, 0);">::</span><span style=3D"color: rgb(0, 0, 13=
6);">operator</span><span style=3D"color: rgb(102, 102, 0);">[](</span><spa=
n style=3D"color: rgb(0, 0, 0);"> size_type pos </span><span style=3D"color=
: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"><br><br><=
/span><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"color=
: rgb(0, 0, 0);"><br>&nbsp; &nbsp; </span><span style=3D"color: rgb(0, 0, 1=
36);">static_assert</span><span style=3D"color: rgb(102, 102, 0);">(</span>=
<span style=3D"color: rgb(0, 0, 0);"> pos </span><span style=3D"color: rgb(=
102, 102, 0);">&lt;</span><span style=3D"color: rgb(0, 0, 0);"> sz</span><s=
pan style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0,=
 0, 0);"> </span><span style=3D"color: rgb(0, 136, 0);">"invalid array inde=
x"</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color:=
 rgb(102, 102, 0);">);</span><span style=3D"color: rgb(0, 0, 0);"><br><br>&=
nbsp; &nbsp; </span><span style=3D"color: rgb(0, 0, 136);">return</span><sp=
an style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 1=
36);">this</span><span style=3D"color: rgb(102, 102, 0);">-&gt;</span><span=
 style=3D"color: rgb(0, 0, 136);">operator</span><span style=3D"color: rgb(=
102, 102, 0);">[]((</span><span style=3D"color: rgb(0, 0, 136);">int</span>=
<span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(=
0, 0, 0);">pos</span><span style=3D"color: rgb(102, 102, 0);">);</span><spa=
n style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, =
0);">//instance default 'non-inline' (run-time) operator[] with 'a' casted =
(from 'inline int') to 'int'</span><span style=3D"color: rgb(0, 0, 0);"><br=
></span><span style=3D"color: rgb(102, 102, 0);">}</span></div></code></div=
><div><span style=3D'color: rgb(0, 128, 0); line-height: 14.07px; font-fami=
ly: DejaVuSansMono,"DejaVu Sans Mono",courier,monospace; font-size: 12.8px;=
 white-space: nowrap;'><br></span></div><div><span style=3D'color: rgb(0, 1=
28, 0); line-height: 14.07px; font-family: DejaVuSansMono,"DejaVu Sans Mono=
",courier,monospace; font-size: 12.8px; white-space: nowrap;'><br></span></=
div><div>By using the above function this invalid code:<br><br><div style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 0);=
">array</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span sty=
le=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(102, 102,=
 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"c=
olor: rgb(0, 102, 102);">5</span><span style=3D"color: rgb(102, 102, 0);">&=
gt;</span><span style=3D"color: rgb(0, 0, 0);"> arr</span><span style=3D"co=
lor: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br>&n=
bsp; &nbsp; <br>cout </span><span style=3D"color: rgb(102, 102, 0);">&lt;&l=
t;</span><span style=3D"color: rgb(0, 0, 0);"> arr</span><span style=3D"col=
or: rgb(102, 102, 0);">[</span><span style=3D"color: rgb(0, 102, 102);">98<=
/span><span style=3D"color: rgb(102, 102, 0);">]</span><span style=3D"color=
: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">&lt;&lt;<=
/span><span style=3D"color: rgb(0, 0, 0);"> endl</span><span style=3D"color=
: rgb(102, 102, 0);">;</span></div></code></div><span style=3D"color: rgb(1=
02, 102, 0); font-family: monospace; background-color: rgb(250, 250, 250);"=
><br></span>Will report compiler error, instead of producing undefined beha=
vior.</div><div><br></div><div>The other usage of the specifier, optimizing=
 code, can be demonstrated by creating one general function - for both 'inl=
ine' and 'non-inline' parameters, of certain algorithm and other 2 for 'inl=
ine' and 'non-inline' which will specialize it, so when you call it with fo=
r example literal - it will be evaluated at compile-time and when you do wi=
th some variable it will create code for run-time execution. Example:</div>=
<div><br></div><div style=3D"border: 1px solid rgb(187, 187, 187); word-wra=
p: break-word; background-color: rgb(250, 250, 250);"><code><div><span styl=
e=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);=
"> </span><span style=3D"color: rgb(102, 0, 102);">SomeAlgo</span><span sty=
le=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136=
);">inline</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 0, 136);">bool</span><span style=3D"color: rgb(0, 0, 0);"=
> bIsInline</span><span style=3D"color: rgb(102, 102, 0);">,</span><span st=
yle=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);"=
>typename</span><span style=3D"color: rgb(102, 102, 0);">(</span><span styl=
e=3D"color: rgb(0, 0, 0);"> bIsInline </span><span style=3D"color: rgb(102,=
 102, 0);">?</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 0, 136);">inline</span><span style=3D"color: rgb(0, 0, 0)=
;"> </span><span style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"=
color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">:</s=
pan><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(=
0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);"> </span><span s=
tyle=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0=
);"> n</span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">=
-&gt;</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"col=
or: rgb(0, 0, 136);">decltype</span><span style=3D"color: rgb(102, 102, 0);=
">(</span><span style=3D"color: rgb(0, 0, 0);">n</span><span style=3D"color=
: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"><br></spa=
n><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"color: rg=
b(0, 0, 0);"><br>&nbsp; &nbsp; </span><span style=3D"color: rgb(136, 0, 0);=
">//Do something with 'n' and return 'int' (or 'inline int')</span><span st=
yle=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102,=
 0);">}</span></div></code></div><div>&nbsp;</div></div></blockquote><block=
quote style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-co=
lor: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"=
 class=3D"gmail_quote"><div dir=3D"ltr"><div></div><div style=3D"border: 1p=
x solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(25=
0, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);">inline</sp=
an><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0=
, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);"> </span><span st=
yle=3D"color: rgb(102, 0, 102);">SomeAlgo</span><span style=3D"color: rgb(1=
02, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">inline</span><=
span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0,=
 136);">int</span><span style=3D"color: rgb(0, 0, 0);"> a</span><span style=
=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"col=
or: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">static_as=
sert</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"=
color: rgb(0, 0, 0);"> a </span><span style=3D"color: rgb(102, 102, 0);">&l=
t;</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color:=
 rgb(0, 102, 102);">0</span><span style=3D"color: rgb(102, 102, 0);">,</spa=
n><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0,=
 136, 0);">"invalid a"</span><span style=3D"color: rgb(0, 0, 0);"> </span><=
span style=3D"color: rgb(102, 102, 0);">);</span><span style=3D"color: rgb(=
0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">return</span><spa=
n style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 0, =
102);">SomeAlgo</span><span style=3D"color: rgb(102, 102, 0);">(</span><spa=
n style=3D"color: rgb(0, 0, 136);">true</span><span style=3D"color: rgb(102=
, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> a</span><span sty=
le=3D"color: rgb(102, 102, 0);">);</span><span style=3D"color: rgb(0, 0, 0)=
;"> </span><span style=3D"color: rgb(102, 102, 0);">}</span><span style=3D"=
color: rgb(0, 0, 0);"><br><br></span><span style=3D"color: rgb(0, 0, 136);"=
>int</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"colo=
r: rgb(102, 0, 102);">SomeAlgo</span><span style=3D"color: rgb(102, 102, 0)=
;">(</span><span style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"=
color: rgb(0, 0, 0);"> a</span><span style=3D"color: rgb(102, 102, 0);">)</=
span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb=
(102, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"> </span><span =
style=3D"color: rgb(0, 0, 136);">return</span><span style=3D"color: rgb(0, =
0, 0);"> </span><span style=3D"color: rgb(102, 0, 102);">SomeAlgo</span><sp=
an style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, =
0, 136);">false</span><span style=3D"color: rgb(102, 102, 0);">,</span><spa=
n style=3D"color: rgb(0, 0, 0);"> a</span><span style=3D"color: rgb(102, 10=
2, 0);">);</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(102, 102, 0);">}</span></div></code></div><div><span style=
=3D"color: rgb(102, 0, 102); font-family: monospace; background-color: rgb(=
250, 250, 250);"><br></span><i>Note that the first function is declared as =
returning an 'inline int', if it was the function itself to be 'inline', it=
 should be 'int inline SomeAlgo', which is an inline function returning 'in=
t'.</i><span style=3D"color: rgb(102, 0, 102); font-family: monospace; back=
ground-color: rgb(250, 250, 250);"><br></span></div><div><span style=3D"col=
or: rgb(102, 0, 102); font-family: monospace; background-color: rgb(250, 25=
0, 250);"><br></span></div><div>And some example instances of 'SomeAlgo':<s=
pan style=3D"color: rgb(102, 0, 102); font-family: monospace; background-co=
lor: rgb(250, 250, 250);"><br><br></span></div><div><div style=3D"border: 1=
px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(2=
50, 250, 250);"><code><div><span style=3D"color: rgb(102, 0, 102);">SomeAlg=
o</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"col=
or: rgb(0, 0, 0);">rand</span><span style=3D"color: rgb(102, 102, 0);">());=
</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: r=
gb(136, 0, 0);">//it will invoke code creation as 'rand()' doesn't return '=
inline' value</span><span style=3D"color: rgb(0, 0, 0);"><br><br></span><sp=
an style=3D"color: rgb(102, 0, 102);">SomeAlgo</span><span style=3D"color: =
rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 102, 102);">9</span=
><span style=3D"color: rgb(102, 102, 0);">);</span><span style=3D"color: rg=
b(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//Will evaluate=
 at compile-time as literal '9' can be used to initialize 'inline' variable=
s</span></div></code></div><br>Another useful feature will be the use of 'i=
nline references' which are such that will point at some compiler-known loc=
ation (nothing special), they'll be useful when you want to create a public=
 const reference to some private member in order to allow public read-only =
access to it. For now we could only write this:<br><br><div style=3D"border=
: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rg=
b(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);">class<=
/span><span style=3D"color: rgb(0, 0, 0);"> A<br></span><span style=3D"colo=
r: rgb(102, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"><br>&nbs=
p; &nbsp; </span><span style=3D"color: rgb(0, 0, 136);">int</span><span sty=
le=3D"color: rgb(0, 0, 0);"> _a</span><span style=3D"color: rgb(102, 102, 0=
);">;</span><span style=3D"color: rgb(0, 0, 0);"><br><br></span><span style=
=3D"color: rgb(0, 0, 136);">public</span><span style=3D"color: rgb(102, 102=
, 0);">:</span><span style=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; <=
/span><span style=3D"color: rgb(0, 0, 136);">const</span><span style=3D"col=
or: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">int</span=
><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102=
, 102, 0);">&amp;</span><span style=3D"color: rgb(0, 0, 0);">a </span><span=
 style=3D"color: rgb(102, 102, 0);">=3D</span><span style=3D"color: rgb(0, =
0, 0);"> _a</span><span style=3D"color: rgb(102, 102, 0);">;</span><span st=
yle=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102,=
 0);">}</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"c=
olor: rgb(102, 102, 0);">;</span></div></code></div><div><br></div></div><d=
iv>Life <a onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3=
A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2F2Ffi7NKWf86cmcQ6\46sa\75D\46sntz\0=
751\46usg\75AFQjCNHhFcfSrxn8cv6HAnNC7ZHfErXRXA';return true;" onclick=3D"th=
is.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fmelpon.org%2Fwandbox%=
2Fpermlink%2F2Ffi7NKWf86cmcQ6\46sa\75D\46sntz\0751\46usg\75AFQjCNHhFcfSrxn8=
cv6HAnNC7ZHfErXRXA';return true;" href=3D"http://melpon.org/wandbox/permlin=
k/2Ffi7NKWf86cmcQ6" target=3D"_blank">example</a>.</div><div><br></div><div=
>But in the case memory for 'a' will be allocated for each 'A' instance, wh=
ich is not a deal. We couldn't write this with 'constexpr' for some strange=
 reason:<br><br><div style=3D"border: 1px solid rgb(187, 187, 187); word-wr=
ap: break-word; background-color: rgb(250, 250, 250);"><code><div><span sty=
le=3D"color: rgb(0, 0, 136);">class</span><span style=3D"color: rgb(0, 0, 0=
);"> A<br></span><span style=3D"color: rgb(102, 102, 0);">{</span><span sty=
le=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; </span><span style=3D"color: =
rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);"> _a</span><=
span style=3D"color: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0=
, 0, 0);"><br><br></span><span style=3D"color: rgb(0, 0, 136);">public</spa=
n><span style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"color: rg=
b(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span style=3D"color: rgb(0, 0, 1=
36);">constexpr</span><span style=3D"color: rgb(0, 0, 0);"> </span><span st=
yle=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0)=
;"> </span><span style=3D"color: rgb(102, 102, 0);">&amp;</span><span style=
=3D"color: rgb(0, 0, 0);">a </span><span style=3D"color: rgb(102, 102, 0);"=
>=3D</span><span style=3D"color: rgb(0, 0, 0);"> _a</span><span style=3D"co=
lor: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"> </spa=
n><span style=3D"color: rgb(136, 0, 0);">// the same as 'const int &amp; co=
nstexpr a' - still produces error</span><span style=3D"color: rgb(0, 0, 0);=
"><br></span><span style=3D"color: rgb(102, 102, 0);">}</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">=
;</span></div></code></div><span style=3D"color: rgb(102, 102, 0); font-fam=
ily: monospace; background-color: rgb(250, 250, 250);"><br></span>Life <a o=
nmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fmelpo=
n.org%2Fwandbox%2Fpermlink%2FfGWsVP2bcqhG3zBa\46sa\75D\46sntz\0751\46usg\75=
AFQjCNGJ4q2ny4R_vY2UIYv3LgimaNK_0Q';return true;" onclick=3D"this.href=3D'h=
ttp://www.google.com/url?q\75http%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2=
FfGWsVP2bcqhG3zBa\46sa\75D\46sntz\0751\46usg\75AFQjCNGJ4q2ny4R_vY2UIYv3Lgim=
aNK_0Q';return true;" href=3D"http://melpon.org/wandbox/permlink/fGWsVP2bcq=
hG3zBa" target=3D"_blank">example</a>.<br><br>By using our new construct th=
is could write this:<br><br><div style=3D"border: 1px solid rgb(187, 187, 1=
87); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code><d=
iv><span style=3D"color: rgb(0, 0, 136);">class</span><span style=3D"color:=
 rgb(0, 0, 0);"> A<br></span><span style=3D"color: rgb(102, 102, 0);">{</sp=
an><span style=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; </span><span styl=
e=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);"=
> _a</span><span style=3D"color: rgb(102, 102, 0);">;</span><span style=3D"=
color: rgb(0, 0, 0);"><br><br></span><span style=3D"color: rgb(0, 0, 136);"=
>public</span><span style=3D"color: rgb(102, 102, 0);">:</span><span style=
=3D"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span style=3D"color=
: rgb(0, 0, 136);">const</span><span style=3D"color: rgb(0, 0, 0);"> </span=
><span style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb=
(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">&amp;</span><s=
pan style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, =
136);">inline</span><span style=3D"color: rgb(0, 0, 0);"> a </span><span st=
yle=3D"color: rgb(102, 102, 0);">=3D</span><span style=3D"color: rgb(0, 0, =
0);"> _a</span><span style=3D"color: rgb(102, 102, 0);">;</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(136, 0, 0);">//=
 inline reference to '_a'</span><span style=3D"color: rgb(0, 0, 0);"><br></=
span><span style=3D"color: rgb(102, 102, 0);">}</span><span style=3D"color:=
 rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">;</span></=
div></code></div><span style=3D"color: rgb(102, 102, 0); font-family: monos=
pace; background-color: rgb(250, 250, 250);"><br></span>Which basically mea=
ns that each reference to 'a', will be evaluated like - '(const int)_a', so=
 no additional memory will be created now.</div><div><br></div><div>Functio=
n specialization will be done to functions with 'inline' parameters, which =
when receive argument values will search for a function which have speciali=
zed them. The parameter specialization will be done via the '=3D=3D' operat=
or (one specialization can be for multiples values). Examples<br><br></div>=
<div style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; =
background-color: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb=
(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);"> </span><span=
 style=3D"color: rgb(102, 0, 102);">FuncAdd</span><span style=3D"color: rgb=
(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">inline</span=
><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, =
0, 136);">typename</span><span style=3D"color: rgb(0, 0, 0);"> T</span><spa=
n style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0=
, 0);"> T a</span><span style=3D"color: rgb(102, 102, 0);">,</span><span st=
yle=3D"color: rgb(0, 0, 0);"> T b</span><span style=3D"color: rgb(102, 102,=
 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"c=
olor: rgb(102, 102, 0);">-&gt;</span><span style=3D"color: rgb(0, 0, 0);"> =
T </span><span style=3D"color: rgb(136, 0, 0);">//general function</span><s=
pan style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102=
, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; =
</span><span style=3D"color: rgb(0, 0, 136);">return</span><span style=3D"c=
olor: rgb(0, 0, 0);"> a </span><span style=3D"color: rgb(102, 102, 0);">+</=
span><span style=3D"color: rgb(0, 0, 0);"> b</span><span style=3D"color: rg=
b(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br></span><s=
pan style=3D"color: rgb(102, 102, 0);">}</span><span style=3D"color: rgb(0,=
 0, 0);"><br><br></span><span style=3D"color: rgb(0, 0, 136);">auto</span><=
span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, =
0, 102);">FuncAdd</span><span style=3D"color: rgb(102, 102, 0);">(</span><s=
pan style=3D"color: rgb(0, 0, 136);">inline</span><span style=3D"color: rgb=
(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">typename</span><=
span style=3D"color: rgb(0, 0, 0);"> T </span><span style=3D"color: rgb(102=
, 102, 0);">=3D=3D</span><span style=3D"color: rgb(0, 0, 0);"> </span><span=
 style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(102, =
102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> T a</span><span sty=
le=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);=
"> T b</span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=
=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">=
-&gt;</span><span style=3D"color: rgb(0, 0, 0);"> T </span><span style=3D"c=
olor: rgb(136, 0, 0);">//specialized function about the 'T' parameter, as n=
o inline params, no implicit 'inline' conversion</span><span style=3D"color=
: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102, 0);">{</spa=
n><span style=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; cout </span><span =
style=3D"color: rgb(102, 102, 0);">&lt;&lt;</span><span style=3D"color: rgb=
(0, 0, 0);"> </span><span style=3D"color: rgb(0, 136, 0);">"I can deal with=
 int"</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"col=
or: rgb(102, 102, 0);">&lt;&lt;</span><span style=3D"color: rgb(0, 0, 0);">=
 endl</span><span style=3D"color: rgb(102, 102, 0);">;</span><span style=3D=
"color: rgb(0, 0, 0);"><br><br>&nbsp; &nbsp; </span><span style=3D"color: r=
gb(0, 0, 136);">return</span><span style=3D"color: rgb(0, 0, 0);"> a </span=
><span style=3D"color: rgb(102, 102, 0);">+</span><span style=3D"color: rgb=
(0, 0, 0);"> b</span><span style=3D"color: rgb(102, 102, 0);">;</span><span=
 style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 1=
02, 0);">}</span></div></code></div><div><div><br></div></div></div></block=
quote><div>Am I to understand the =E2=80=9Cinline typename T=E2=80=9D as an=
 alternative&nbsp;method of expressing templates or one function that will =
work for any type?</div><div>&nbsp;</div><div>Firstly, whether or not you w=
ant this as a template replacement, I object to having to specify the type =
when the compiler can deduce that from the variables.</div><div>&nbsp;</div=
><div>If it is meant as a replacement for a template, having the type as a =
parameter is confusing=E2=80=A6 I would expect one function, and only one f=
unction, to be substantiated when a function is not explicitly templated.</=
div><div>&nbsp;</div><div>If it is not, I am at a loss as to how a compiler=
 is meant to implement it efficiently (or at all, if it is defined in a sep=
arate TU).</div><div>&nbsp;</div><div>Regarding the second (overloaded) fun=
ction, is that supposed to overload on type int?&nbsp; If so, =E2=80=9Cauto=
 FuncAdd(int, =E2=80=A6=E2=80=9D would be more in line with current practic=
e.&nbsp; This will not create an ambiguity, as the parameter is already def=
ined as a typename.</div><div>&nbsp;</div><blockquote style=3D"margin: 0px =
0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); bo=
rder-left-width: 1px; border-left-style: solid;" class=3D"gmail_quote"><div=
 dir=3D"ltr"><div><div>And some 'FuncAdd' instances:<br><br></div></div><di=
v style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; bac=
kground-color: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(10=
2, 0, 102);">FuncAdd</span><span style=3D"color: rgb(102, 102, 0);">(</span=
><span style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb=
(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span =
style=3D"color: rgb(0, 102, 102);">9</span><span style=3D"color: rgb(102, 1=
02, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 102, 102);">5</span><span style=3D"color: rgb(102, 102, 0=
);">);</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"co=
lor: rgb(136, 0, 0);">// 'FuncAdd' int specialization called (of type - 'au=
to (inline typename T =3D=3D int, T a, T b) -&gt; T')</span><span style=3D"=
color: rgb(0, 0, 0);"><br><br></span><span style=3D"color: rgb(102, 0, 102)=
;">FuncAdd</span><span style=3D"color: rgb(102, 102, 0);">(</span><span sty=
le=3D"color: rgb(0, 0, 136);">double</span><span style=3D"color: rgb(102, 1=
02, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 102, 102);">3.14f</span><span style=3D"color: rgb(102, 10=
2, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(0, 102, 102);">1</span><span style=3D"color: rgb(102, 102, 0);"=
>);</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color=
: rgb(136, 0, 0);">// 'FuncAdd' general called (of type - 'auto (inline typ=
ename T, T a, T b) -&gt; T')</span></div></code></div><div><br></div><div><=
br></div><div>Some additional 'inline' specifier rules connected to special=
ization and classes. A class can have special methods for 'inline' instance=
s of it, which are defined by specifiying 'inline' after it's declaration (=
in such methods 'this' will be inline pointer and will point to an sequence=
d 'inline' &nbsp;array holding it's inline member objects). Inline instance=
s of class will instance only it's special 'inline-this' methods and won't =
create any memory for it's non-inline members. Classes can't be specialized=
 but you can create a derived class which specialize their methods. But thi=
s could cha</div></div>...</blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_417_931272536.1418826323071--
------=_Part_416_1204189752.1418826323071--

.


Author: sasho648 <sasho648@mail.bg>
Date: Wed, 17 Dec 2014 10:12:46 -0800 (PST)
Raw View
------=_Part_5292_1350602960.1418839966358
Content-Type: multipart/alternative;
 boundary="----=_Part_5293_681799930.1418839966358"

------=_Part_5293_681799930.1418839966358
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable


>
> Am I to understand the =E2=80=9Cinline typename T=E2=80=9D as an alternat=
ive method of=20
> expressing templates or one function that will work for any type?


It's an alternative to templates, as I said at the beginning functions with=
=20
either inline parameters or return-value will be implicitly 'inline' and=20
also should be executed by the compiler, the same way as general template's=
=20
are.=20

Firstly, whether or not you want this as a template replacement, I object=
=20
> to having to specify the type when the compiler can deduce that from the=
=20
> variables.


Automated 'type' deduction is being better implemented by using 'auto'=20
keyword as function parameter or return-value. Like this:

auto FuncAdd(auto a, auto b) //also general function, which have parameters=
=20
and return-value of any type=20
{
    return a + b;
}

Inline arguments are meant to be used and not automatically deduced. You=20
may for example call the function 'FuncAdd', I declared above with first=20
argument of type 'int' and 'a', 'b' from type double - in which case they=
=20
should be converted. Example:

double a, b;

FuncAdd(int, a, b); //here 'a' and 'b' will be implicitly converted into=20
'int'


Sometimes we want to specify some setting on function local instead of=20
parameter in which case 'auto' won't do our job. Examples:

void SomeFunc(inline typename T, inline size_t sz)
{
    T arr[sz]; //create some local array with specified inline size and typ=
e

}


Regarding the second (overloaded) function, is that supposed to overload on=
=20
> type int?  If so, =E2=80=9Cauto FuncAdd(int, =E2=80=A6=E2=80=9D would be =
more in line with current=20
> practice.  This will not create an ambiguity, as the parameter is already=
=20
> defined as a typename.


You're absolutely right - we could create the 'int' overload of the=20
function just like you said but using templates is the same - you aren't=20
required to specialize them but instead create non-template function with=
=20
the needed type. I just wanted to show that the same behavior as=20
'template''s specializing is possible (but not required). Examples of the=
=20
above using templates:

template<typename T>
T FuncAdd(T a, T b)
{
    return a + b;
}


int FuncAdd(int a, int b)
{
    cout << "I can deal with int" << endl;
   =20
    return a + b;
}


template<>
int FuncAdd(int a, int b)
{
    cout << "I can deal with int, template" << endl;
   =20
    return a + b;
}

As you can see there is a function template specialization of 'int' and a=
=20
normal function which just have parameters of the type. In the case if we=
=20
instance 'FuncAdd' with int's the non-template function will be executed.

Life example <http://melpon.org/wandbox/permlink/EXIHkQsUGb9UkgGM>.

As you can clearly see those 'template''s only add additional code=20
complexity. I believe it's way more natural to use inline function=20
arguments.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_5293_681799930.1418839966358
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); =
border-left-style: solid; padding-left: 1ex;">Am I to understand the =E2=80=
=9Cinline typename T=E2=80=9D as an alternative&nbsp;method of expressing t=
emplates or one function that will work for any type?</blockquote><div><br>=
</div>It's an alternative to templates, as I said at the beginning function=
s with either inline parameters or return-value will be implicitly 'inline'=
 and also should be executed by the compiler, the same way as general templ=
ate's are.&nbsp;<div><br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(20=
4, 204, 204); border-left-style: solid; padding-left: 1ex;">Firstly, whethe=
r or not you want this as a template replacement, I object to having to spe=
cify the type when the compiler can deduce that from the variables.</blockq=
uote><div><br></div><div>Automated 'type' deduction is being better impleme=
nted by using 'auto' keyword as function parameter or return-value. Like th=
is:<br><br><span style=3D"font-family: monospace; color: rgb(0, 0, 136); ba=
ckground-color: rgb(250, 250, 250);"></span></div><div class=3D"prettyprint=
" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; bac=
kground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">FuncAdd</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #800;" class=3D"styled-by-prettify">//also gene=
ral function, which have parameters and return-value of any type </span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> a </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">+</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">}</span></div></code></div><div><span style=3D"font-family: monospace;=
 color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"><br></span=
>Inline arguments are meant to be used and not automatically deduced. You m=
ay for example call the function 'FuncAdd', I declared above with first arg=
ument of type 'int' and 'a', 'b' from type double - in which case they shou=
ld be converted. Example:<br><br></div><div class=3D"prettyprint" style=3D"=
border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-col=
or: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">double</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">FuncAdd</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">//here 'a' and 'b' will be implicitly conv=
erted into 'int'</span></div></code></div><div><span style=3D"color: rgb(10=
2, 0, 102); font-family: monospace; background-color: rgb(250, 250, 250);">=
<br></span></div><div><br></div><div>Sometimes we want to specify some sett=
ing on function local instead of parameter in which case 'auto' won't do ou=
r job. Examples:<br><br></div><div class=3D"prettyprint" style=3D"border: 1=
px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(2=
50, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><=
span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">SomeFunc</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">inline</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t sz</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; T arr</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">sz</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//create some local array with specified inline size and t=
ype</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br=
></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div><=
/code></div><div><br><span style=3D"color: rgb(102, 0, 102); font-family: m=
onospace; background-color: rgb(250, 250, 250);"><br></span><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1=
px; border-left-color: rgb(204, 204, 204); border-left-style: solid; paddin=
g-left: 1ex;">Regarding the second (overloaded) function, is that supposed =
to overload on type int?&nbsp; If so, =E2=80=9Cauto FuncAdd(int, =E2=80=A6=
=E2=80=9D would be more in line with current practice.&nbsp; This will not =
create an ambiguity, as the parameter is already defined as a typename.</bl=
ockquote><div><br></div><div>You're absolutely right - we could create the =
'int' overload of the function just like you said but using templates is th=
e same - you aren't required to specialize them but instead create non-temp=
late function with the needed type. I just wanted to show that the same beh=
avior as 'template''s specializing is possible (but not required). Examples=
 of the above using templates:<br><br><div class=3D"prettyprint" style=3D"b=
order: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-colo=
r: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpretty=
print"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>T </span><span style=3D"color:=
 #606;" class=3D"styled-by-prettify">FuncAdd</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">T a</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> T b</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">+</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Func=
Add</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &n=
bsp; cout </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #080;" class=3D"styled-by-prettify">"I can deal=
 with int"</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> endl</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; <br>&nb=
sp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>return</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">+</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> b</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br><br></span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">FuncAdd</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp; cout </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">"I ca=
n deal with int, template"</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> endl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp=
; &nbsp; <br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> a </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">+</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> b<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div=
><div><br></div></div></div><div>As you can see there is a function templat=
e specialization of 'int' and a normal function which just have parameters =
of the type. In the case if we instance 'FuncAdd' with int's the non-templa=
te function will be executed.</div><div><br></div><div>Life <a href=3D"http=
://melpon.org/wandbox/permlink/EXIHkQsUGb9UkgGM">example</a>.</div><div><br=
></div><div>As you can clearly see those 'template''s only add additional c=
ode complexity. I believe it's way more natural to use inline function argu=
ments.</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_5293_681799930.1418839966358--
------=_Part_5292_1350602960.1418839966358--

.


Author: sasho648 <sasho648@mail.bg>
Date: Tue, 16 Dec 2014 05:40:01 -0800 (PST)
Raw View
------=_Part_270_847709593.1418737201599
Content-Type: multipart/alternative;
 boundary="----=_Part_271_1048615353.1418737201599"

------=_Part_271_1048615353.1418737201599
Content-Type: text/plain; charset=UTF-8

'Constexpr' are very bad idea as they introduce a new keyword only to tell
us that certain functions MAY be evaluated at compile-time (but also may
not). Also 'constexpr' can be only whole functions and not different
arguments, or only return-value (which would be twice more-useful). My new
construct could deprecated templates too.

The idea is simple, variables, references or pointers declared as 'inline'
can be constructed only once with other 'inline' variables. As 'inline'
variable is a compiler-time known constant (can't be edited). Function with
inline return value or arguments will be implicitly inline themselves.
Inline classes specify that each of their members are inline (including
functions), contain no virtual methods and 'this' is an inline pointer. If
a class-constructor modify it's members types or size using inline
variables known only at instance of it, then this class creates an
incomplete type, which depending on it's construction way will create
different classes. If a function return or arguments type depends on other
arguments, then the function is of incomplete type, which depends on them
and each will form the actual type. Conversion from 'inline' to any other
type is possible but not the opposite (you can't cast to 'inline').

The main motivation for creating this new behavior for 'inline' keyword is
enabling static checks for function arguments and also creating more
optimized code which will calculate inline variables at compile-time and
other ones at run-time. Examples of the first:

If we have an 'std::array', declared like this:

std::array<int, 5> arr

And we instance it like that:

cout << arr[86] << endl;

Life example <http://melpon.org/wandbox/permlink/53cTbWhdAMp8blxI>.

It will compile just fine and produce an run-time error! You'll say who
will write this stupid code anyway but imagine that '86' is actually a call
to 'constexpr' and we have the following code:

constexpr int EvaluateSpecialArrayIndex(int a)
{ return a * sizeof(int); }

//cout array like this

cout << arr[EvaluateSpecialArrayIndex(4)] << endl;

Life example <http://melpon.org/wandbox/permlink/3wJAm6UJgGWuUKA6>.

You'll think now - hey but I could write a static_assert in the above
function to check if it's in array bounds but you are deadly wrong, 'int a'
is not a 'constexpr' to write a static_assert - you are amazed now - how it
is not a 'constexpr' as the function should be evaluated at compile-time
but the truth is that this is not a rule, we could instance
'EvaluateSpecialArrayIndex' fully legally with 'lvalue' also, 'constexpr'
functions MAY be evaluated at run-time but MAY not (which depends on where
are they instanced - if they should store their return-value into constexpr
as in the above example, they are evaluated at compile time otherwise at
run-time so the function should suppose that the arguments are 'lvalues') :

int a; //'lvalue'

cout << EvaluateSpecialArrayIndex(a) << endl;


Life example <http://melpon.org/wandbox/permlink/165Zoho8vNjWTPE2>.

So this is code is wrong:

constexpr int EvaluateSpecialArrayIndex(int a)
{ static_assert( a < 5, "a should be < 5"); return a * sizeof(int); }

Life example <http://melpon.org/wandbox/permlink/lrGMr2bECzpfbCxE>.


If my suggestion is accepted we could overload std::array for inline values
as following (supposing templates are still used):

template<typename T, size_t sz>
T & std::array::operator[]( inline size_type pos )

{
    static_assert( pos < sz, "invalid array index");

    return this->operator[]((size_type)pos); //cast from 'inline size_type'
to 'size_type' in order to instance 'operator[]' for 'lvalues'
}

And when 'inline' (or compiler known) index is accessed in array - compiler
error will arise and so in the previous examples, this:

cout << arr[EvaluateSpecialArrayIndex(4)] << endl;

will cause an compiler error.

As I said it will also allow program explicit optimizations like for
example the fibonacci algorithm series:

auto fibonacci_general(auto n) -> decltype(n) {

 if (n == 0)
 {
 return 0;
 }
 else if (n == 1)
 {
 return 1;
 }

 return fibonacci(n-1) + fibonacci(n-2);
}

int fibonacci(int n) { return fibonacci_general(n); } //creates and
instance 'fibonacci_general' with lvalues ('int')

inline int fibonacci(inline int n) { static_assert( n < 0, "invalid
parameter"); return fibonacci_general(n); } //validates param 'n', creates
and instance 'fibonacci_general' with inline values ('inline int')

Now in the above code, depending on the value type called, the 'fibonacci'
function will be either evaluated at compile-time or generated code for
run-time execution. Examples:


int n;

fibonacci(n); //as 'n' is 'lvalue' fibonacci will be called at run-time

fibonacci(90); //as 'inline int' is passed 'fibonacci' will be evaluated at
run-time

Next I'll show why 'inline' variables are the superior of templates.
Imagine you have a class and you want one of it's member to be have public
read-only access and private read-write one. For now you could achieve this
only by using get/setters which are not ideal (you should always write and
call them fro every member which is additional hassle). You could write
this:

class A
{
int _a;

public:

const int &a = _a;
} ;

Unfortunately the above construct will always require additional
sizeof(const int &) bytes in order to store the reference, no matter it
will always refer the same object.

Life example <http://melpon.org/wandbox/permlink/tC85ULgy65deodZL>.

We can not optimize this by using templates as they don't know anything
about the 'A' members. The most equivalent code will look something like
this:

template<public: const int &a = _a>
class A
{
int _a;
} ;

Which of-course is illegal, the same applies for 'constexpr':

class A
{
    int _a;

public:

    constexpr int &a = _a; // the same as int & constexpr a = _a;
} ;

By using my construct this could be re-written like this:

class A
{
    int _a;

public:

    int & inline a = _a; // 'a' is now by default an 'inline reference' to
'_a'
} ;

And so now as '_a' is an inline reference all instances of 'a' will be
replaced with something similar to '(const int)obj._a' and no run-time
memory will be allocated.

As 'inline' will fully replace 'template''s we should talk about 'inline'
functions and classes specializations. Every function which parameters and
return value types depends on other inline arguments can be specialize in
another function. Examples:

func_add(inline typename T, T a, T b) -> T
{
} //'func_add' general inline function

func_add(inline typename T == int, T a, T b) -> T
{

}//'func_add' specialization for int's - it doesn't have inline arguments
or return-value so it's not implicitly converted into inline


Note the syntax - function specialization of argument will be done by using
the equal sign '=='

And several example instances of 'func_add':

func_add(double, 3.14, 2); //will instance inline function

func_add(int, 3, 2); //will instance the specialized 'int' function (note
that the '==' is different than the '=' and we can not left the first
argument position with no value)


And the word is given to 'class' specializations. A class will be
specialized after it's 'inline' constructor ends execution. Object being
constructed using inline constructor, if when executed an specialization of
the class is found it's constructor will be instanced too. Specialization
of inline class members will be done using the 'equal' sign as the
arguments. Example:

class A //general class
{
    T(inline typename arg) : T(arg) {}

    inline typename T;

    T data;
} ;


class A //specialized class for int's
{
    T(int arg) : data(arg) { cout << data << endl; }

    inline typename T == int;

    T data;
} ;



And if we instance an object with some int like this for example:


A obj(9);

This will happen - 'T(inline typename arg)' will be instanced, creating an
'class A' specialization with 'int', compiler will search if there exist
and if so it'll start using it's functionality and thus call 'T(int arg)'
and 'cout' 9,

Now some of you will ask - so every specialization will have the same type.
No that's not true. In the above example class 'A' is from type 'decltype(A(int{}))'
but also from type 'A', so if there is a function using it, they could
either be general for all 'A''s or only for the 'A''s with member 'T' of
type 'int' like this:

void Func(A obj); //general function for objects of type 'A' thus inline

void Func(decltype(A(int{})) obj); //function of objects with specialized
'A' type which left no inline members so function is not inline

The same applies for functions. Examples of function 'func_add':

void Func(decltype(func_add) &obj); //general function with argument of
type 'auto (&)(inline typename T, T a, T b) -> T', as include inline
members function implicit inline



void Func(decltype(func_add(int, int(), int())) &obj); //function with
argument of type  'auto (&)(inline typename T == int, T a, T b) -> T', no
inline so function isn't implicit inline

I believe this wasn't the clearest wrote of my life but I also believe you
got the point and the benefits of including this syntax.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_271_1048615353.1418737201599
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>'Constexpr' are very bad idea as they introduce a new=
 keyword only to tell us that certain functions MAY be evaluated at compile=
-time (but also may not). Also 'constexpr' can be only whole functions and =
not different arguments, or only return-value (which would be twice more-us=
eful). My new construct could deprecated templates too.</div><div><br></div=
><div>The idea is simple, variables, references or pointers declared as 'in=
line' can be constructed only once with other 'inline' variables. As 'inlin=
e' variable is a compiler-time known constant (can't be edited). Function w=
ith inline return value or arguments will be implicitly inline themselves. =
Inline classes specify that each of their members are inline (including fun=
ctions), contain no virtual methods and 'this' is an inline pointer. If a c=
lass-constructor modify it's members types or size using inline variables k=
nown only at instance of it, then this class creates an incomplete type, wh=
ich depending on it's construction way will create different classes. If a =
function return or arguments type depends on other arguments, then the func=
tion is of incomplete type, which depends on them and each will form the ac=
tual type. Conversion from 'inline' to any other type is possible but not t=
he opposite (you can't cast to 'inline').<br><br>The main motivation for cr=
eating this new behavior for 'inline' keyword is enabling static checks for=
 function arguments and also creating more optimized code which will calcul=
ate inline variables at compile-time and other ones at run-time. Examples o=
f the first:<br><br>If we have an 'std::array', declared like this:<br><br>=
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); w=
ord-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">array</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">5</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> arr</span></div></code></div><br>And w=
e instance it like that:<br><br><span style=3D"font-family: monospace; back=
ground-color: rgb(250, 250, 250);"><div class=3D"prettyprint" style=3D"bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: =
rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettypri=
nt"><span style=3D"color: #000;" class=3D"styled-by-prettify">cout </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"col=
or: #066;" class=3D"styled-by-prettify">8</span><font color=3D"#006666"><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">6</span></font><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">]</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> endl</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span></div></code></div><div><span style=3D"=
font-family: monospace; background-color: rgb(250, 250, 250);"><br></span><=
/div>Life <a href=3D"http://melpon.org/wandbox/permlink/53cTbWhdAMp8blxI">e=
xample</a>.<br><br></span>It will compile just fine and produce an run-time=
 error! You'll say who will write this stupid code anyway but imagine that =
'86' is actually a call to 'constexpr' and we have the following code:<br><=
br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">EvaluateSpecialArrayIndex</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> a</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">return</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> a </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">sizeof</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"c=
olor: #800;" class=3D"styled-by-prettify">//cout array like this</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>cout </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"fon=
t-family: Arial, Helvetica, sans-serif;"><span style=3D"color: #606;" class=
=3D"styled-by-prettify">EvaluateSpecialArrayIndex</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><font color=3D"#006666"><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">4</span></font></span=
><font color=3D"#006666" style=3D"font-family: Arial, Helvetica, sans-serif=
;"><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span></font=
><span style=3D"color: #660;" class=3D"styled-by-prettify">]</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> endl</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span></div></code></div><div><br></div=
><div>Life <a href=3D"http://melpon.org/wandbox/permlink/3wJAm6UJgGWuUKA6">=
example</a>.</div><div><br></div><div>You'll think now - hey but I could wr=
ite a static_assert in the above function to check if it's in array bounds =
but you are deadly wrong, 'int a' is not a 'constexpr' to write a static_as=
sert - you are amazed now - how it is not a 'constexpr' as the function sho=
uld be evaluated at compile-time but the truth is that this is not a rule, =
we could instance 'EvaluateSpecialArrayIndex' fully legally with 'lvalue' a=
lso, 'constexpr' functions MAY be evaluated at run-time but MAY not (which =
depends on where are they instanced - if they should store their return-val=
ue into constexpr as in the above example, they are evaluated at compile ti=
me otherwise at run-time so the function should suppose that the arguments =
are 'lvalues') :</div><div><br></div><div><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">int</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//'lvalue'</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br>cout </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;"=
 class=3D"styled-by-prettify">EvaluateSpecialArrayIndex</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">a</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> endl</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span></div></code></div><span style=3D"color: rgb(102, 0, 102); back=
ground-color: rgb(250, 250, 250);"><br></span><br>Life <a href=3D"http://me=
lpon.org/wandbox/permlink/165Zoho8vNjWTPE2">example</a>.</div><div><br></di=
v><div>So this is code is wrong:<br><br><div class=3D"prettyprint" style=3D=
"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-co=
lor: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">constexp=
r</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">EvaluateSpecialArrayIndex</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
static_assert</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"=
styled-by-prettify">"a should be &lt; 5"</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> a </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">*</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">sizeof</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div></code></div><div><font color=3D"#000=
088" face=3D"monospace"><br></font></div>Life <a href=3D"http://melpon.org/=
wandbox/permlink/lrGMr2bECzpfbCxE">example</a>.</div><div><br></div><div><b=
r></div><div>If my suggestion is accepted we could overload std::array for =
inline values as following (supposing templates are still used):<br><br></d=
iv><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187)=
; word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">template</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> size_t sz</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>T </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&am=
p;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">array</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">operator</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">[](</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> size_type pos </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br><br></span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">static_assert</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> pos </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> sz<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">"invalid array index"</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">this</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">operator</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">[]((</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">size_type</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">pos</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//ca=
st from 'inline size_type' to 'size_type' in order to instance 'operator[]'=
 for 'lvalues'</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}<=
/span></div></code></div><div><span class=3D"br0" style=3D"line-height: 14.=
0799999237061px; font-family: DejaVuSansMono, 'DejaVu Sans Mono', courier, =
monospace; font-size: 12.8000001907349px; white-space: nowrap;"><font color=
=3D"#008080"><br></font></span></div><div>And when 'inline' (or compiler kn=
own) index is accessed in array - compiler error will arise and so in the p=
revious examples, this:<br><br><div class=3D"prettyprint" style=3D"border: =
1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(=
250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #000;" class=3D"styled-by-prettify">cout </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">EvaluateSpecialArrayIndex</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #066;" class=3D"styled-by-prettify">4</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">)]</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> endl</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span></div></code></div><span class=3D"styled-by-prettify" st=
yle=3D"font-family: monospace; color: rgb(102, 102, 0); background-color: r=
gb(250, 250, 250);"><br></span>will cause an compiler error.</div><div><br>=
</div><div>As I said it will also allow program explicit optimizations like=
 for example the fibonacci algorithm series:<br><br></div><div><div class=
=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: =
break-word; background-color: rgb(250, 250, 250);"><code class=3D"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> fibonacci_general</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> n</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">decltype</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">n</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br><br=
>&nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">if<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">n </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" cla=
ss=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>&nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>&nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">r=
eturn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp;</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> <br>&nbsp;</span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">else</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">if</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">n </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>&nbsp;</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>&nbsp;</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp;=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp;<br>&nbsp=
;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">return</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> fibonacci</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">n</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"color: #=
066;" class=3D"styled-by-prettify">1</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">+</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
fibonacci</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">n</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">-</span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> fibonacci</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> n</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">return</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> fibonacci_general</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">n</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//creates and instance 'fibo=
nacci_general' with lvalues ('int')</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> fibonacci</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">inlin=
e</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">static_assert</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 n </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" cla=
ss=3D"styled-by-prettify">"invalid parameter"</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> fibonacci_general</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">n</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//validates param 'n', creat=
es and instance 'fibonacci_general' with inline values ('inline int')</span=
></div></code></div><span style=3D"color: rgb(136, 0, 0); background-color:=
 rgb(250, 250, 250);"><span class=3D"styled-by-prettify"><br></span><span c=
lass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);">Now in the above=
 code, depending on the value type called, the '</span></span><span style=
=3D"color: rgb(0, 0, 0); font-family: monospace; background-color: rgb(250,=
 250, 250);">fibonacci</span><span style=3D"color: rgb(0, 0, 0); background=
-color: rgb(250, 250, 250);">' function will be either evaluated at compile=
-time or generated code for run-time execution. Examples:<br><br><br></span=
></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, =
187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code c=
lass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> n</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br>fibonacci</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">n</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #800;" class=3D"styled-by-prettify">//as 'n' is 'lvalu=
e' fibonacci will be called at run-time</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br><br>fibonacci</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" cl=
ass=3D"styled-by-prettify">90</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify=
">//as 'inline int' is passed 'fibonacci' will be evaluated at run-time</sp=
an></div></code></div><div><span style=3D"color: rgb(0, 0, 0); font-family:=
 monospace; background-color: rgb(250, 250, 250);"><br></span></div><div>Ne=
xt I'll show why 'inline' variables are the superior of templates. Imagine =
you have a class and you want one of it's member to be have public read-onl=
y access and private read-write one. For now you could achieve this only by=
 using get/setters which are not ideal (you should always write and call th=
em fro every member which is additional hassle). You could write this:<br><=
br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> A<br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> _a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">public</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">a </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> _a=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">;</span></div></code></div><div><br></div><=
div>Unfortunately the above construct will always require additional sizeof=
(const int &amp;) bytes in order to store the reference, no matter it will =
always refer the same object.</div><div><br></div><div>Life <a href=3D"http=
://melpon.org/wandbox/permlink/tC85ULgy65deodZL">example</a>.&nbsp;</div><d=
iv><br></div><div>We can not optimize this by using templates as they don't=
 know anything about the 'A' members. The most equivalent code will look so=
mething like this:<br><br><div class=3D"prettyprint" style=3D"border: 1px s=
olid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, =
250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">public</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">a </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> _a</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> A<br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> _a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">;</span></div></code></div><span clas=
s=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102, 1=
02, 0); background-color: rgb(250, 250, 250);"><br></span>Which of-course i=
s illegal, the same applies for 'constexpr':</div><div><br></div><div><div =
class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-w=
rap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pret=
typrint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> A<br></span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> _a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">public</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">a </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> _a</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// the =
same as int &amp;&nbsp;</span><span style=3D"color: rgb(136, 0, 0); font-fa=
mily: Arial, Helvetica, sans-serif;">constexpr&nbsp;</span><span style=3D"c=
olor: rgb(136, 0, 0); font-family: Arial, Helvetica, sans-serif;">a =3D _a;=
</span></div><div class=3D"subprettyprint"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">;</span></div></code></div><div><br>By using my construct this coul=
d be re-written like this:<br><br><div class=3D"prettyprint" style=3D"borde=
r: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: r=
gb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprin=
t"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> A<br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> _a</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">public</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">inl=
ine</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> _a</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">// 'a' is now by default an 'inline reference'=
 to '_a'</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span></div></code></div=
><div class=3D"subprettyprint" style=3D"background-color: rgb(250, 250, 250=
);"><span class=3D"styled-by-prettify" style=3D"font-family: monospace; col=
or: rgb(102, 102, 0);"><br><span style=3D"color: rgb(34, 34, 34); font-fami=
ly: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">An=
d so now as '_a' is an inline reference all instances of 'a' will be replac=
ed with something similar to '</span></span><span style=3D"font-family: Ari=
al, Helvetica, sans-serif; background-color: white;">(const int)</span><spa=
n style=3D"font-family: Arial, Helvetica, sans-serif; background-color: rgb=
(255, 255, 255);">obj._a' and no run-time memory will be allocated.<br><br>=
As 'inline' will fully replace 'template''s we should talk about 'inline' f=
unctions and classes specializations. Every function which parameters and r=
eturn value types depends on other inline arguments can be</span><span styl=
e=3D"background-color: rgb(255, 255, 255);">&nbsp;specialize in another fun=
ction. Examples:<br><br></span></div><div class=3D"subprettyprint" style=3D=
"background-color: rgb(250, 250, 250);"><div class=3D"prettyprint" style=3D=
"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-co=
lor: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #000;" class=3D"styled-by-prettify">func_add=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T a</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> T b</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">-&gt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> T<br></span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">//'func_add' general inline function</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br><br>func_add</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> T </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T a</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> T b</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> T<br></span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br><br></span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">}</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//'=
func_add' specialization for int's - it doesn't have inline arguments or re=
turn-value so it's not implicitly converted into inline</span></div></code>=
</div><div class=3D"subprettyprint" style=3D"font-family: monospace;"><span=
 class=3D"styled-by-prettify" style=3D"color: rgb(136, 0, 0);"><br></span><=
/div></div><div class=3D"subprettyprint" style=3D"background-color: rgb(250=
, 250, 250);"><span style=3D"background-color: rgb(255, 255, 255);"><br></s=
pan></div><div class=3D"subprettyprint" style=3D"background-color: rgb(250,=
 250, 250);"><span class=3D"styled-by-prettify"><font color=3D"#000000"><fo=
nt face=3D"monospace">Note the syntax - function&nbsp;specialization of&nbs=
p;argument will be done by using the equal sign '=3D=3D'</font></font></spa=
n></div><div class=3D"subprettyprint" style=3D"background-color: rgb(250, 2=
50, 250);"><span style=3D"background-color: rgb(255, 255, 255);"><br></span=
></div><div class=3D"subprettyprint" style=3D"background-color: rgb(250, 25=
0, 250);"><span style=3D"background-color: rgb(255, 255, 255);">And several=
 example instances of '</span><span style=3D"color: rgb(0, 0, 0); font-fami=
ly: monospace;">func_add</span><span style=3D"background-color: rgb(255, 25=
5, 255);">':<br><br></span></div><div class=3D"prettyprint" style=3D"border=
: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rg=
b(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint=
"><span style=3D"color: #000;" class=3D"styled-by-prettify">func_add</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" =
class=3D"styled-by-prettify">3.14</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">//will instance inli=
ne function</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br>func_add</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">in=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">3</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D=
"styled-by-prettify">2</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//wil=
l instance the specialized 'int' function (note that the '=3D=3D' is differ=
ent than the '=3D' and we can not left the first argument position with no =
value)</span></div></code></div><div class=3D"subprettyprint" style=3D"back=
ground-color: rgb(250, 250, 250);"><span style=3D"background-color: rgb(255=
, 255, 255);"><br></span></div><div class=3D"subprettyprint" style=3D"backg=
round-color: rgb(250, 250, 250);"><span style=3D"background-color: rgb(255,=
 255, 255);"><br></span></div><div class=3D"subprettyprint" style=3D"backgr=
ound-color: rgb(250, 250, 250);"><span style=3D"background-color: rgb(255, =
255, 255);">And the word is given to 'class' specializations. A class will =
be specialized after it's 'inline' constructor ends execution. Object being=
 constructed using inline constructor, if when executed an&nbsp;specializat=
ion of the class is found it's constructor will be instanced too.&nbsp;Spec=
ialization of inline class members will be done using the 'equal' sign as t=
he arguments. Example:<br><br></span></div><div class=3D"subprettyprint" st=
yle=3D"background-color: rgb(250, 250, 250);"><div class=3D"prettyprint" st=
yle=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgro=
und-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"s=
ubprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">cl=
ass</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> A </sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">//general clas=
s</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; T</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> arg</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">arg</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{}</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br>&nbsp; &nbsp; T data</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> A </span><span s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">//specialized class for =
int's</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; T<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> arg</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> data</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>arg</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> cout </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> data </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> endl</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">inline</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typ=
ename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; T data</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span></div></code></div><span class=3D"styled-by-pret=
tify" style=3D"font-family: monospace; color: rgb(102, 102, 0);"><br></span=
><span style=3D"background-color: rgb(255, 255, 255);"><br></span></div><di=
v class=3D"subprettyprint" style=3D"background-color: rgb(250, 250, 250);">=
<div class=3D"subprettyprint"><br><span style=3D"background-color: rgb(255,=
 255, 255);">And if we instance an object with some int like this for examp=
le:<br><br><br></span></div><div class=3D"subprettyprint"><span style=3D"ba=
ckground-color: rgb(255, 255, 255);"><div class=3D"prettyprint" style=3D"bo=
rder: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color=
: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #000;" class=3D"styled-by-prettify">A obj</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span st=
yle=3D"color: #066;" class=3D"styled-by-prettify">9</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span></div></code></div><br></=
span></div><div class=3D"subprettyprint"><span style=3D"background-color: r=
gb(255, 255, 255);">This will happen - '</span><span class=3D"styled-by-pre=
ttify" style=3D"font-family: monospace; color: rgb(0, 0, 0);">T</span><span=
 class=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(1=
02, 102, 0);">(</span><span class=3D"styled-by-prettify" style=3D"font-fami=
ly: monospace; color: rgb(0, 0, 136);">inline</span><span class=3D"styled-b=
y-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0);">&nbsp;</=
span><span class=3D"styled-by-prettify" style=3D"font-family: monospace; co=
lor: rgb(0, 0, 136);">typename</span><span class=3D"styled-by-prettify" sty=
le=3D"font-family: monospace; color: rgb(0, 0, 0);">&nbsp;arg</span><span c=
lass=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102=
, 102, 0);">)</span><span style=3D"background-color: rgb(255, 255, 255);">'=
 will be instanced, creating an 'class A' specialization with 'int', compil=
er will search if there exist and if so it'll start using it's&nbsp;functio=
nality and thus call '</span><span class=3D"styled-by-prettify" style=3D"fo=
nt-family: monospace; color: rgb(0, 0, 0);">T</span><span class=3D"styled-b=
y-prettify" style=3D"font-family: monospace; color: rgb(102, 102, 0);">(</s=
pan><span class=3D"styled-by-prettify" style=3D"font-family: monospace; col=
or: rgb(0, 0, 136);">int</span><span class=3D"styled-by-prettify" style=3D"=
font-family: monospace; color: rgb(0, 0, 0);">&nbsp;arg</span><span class=
=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102, 10=
2, 0);">)</span><span style=3D"background-color: rgb(255, 255, 255);">'</sp=
an><span style=3D"background-color: rgb(255, 255, 255);">&nbsp; and 'cout' =
9,</span></div><div class=3D"subprettyprint"><span style=3D"background-colo=
r: rgb(255, 255, 255);"><br></span></div><div class=3D"subprettyprint"><spa=
n style=3D"background-color: rgb(255, 255, 255);">Now some of you will ask =
- so every specialization will have the same type. No that's not true. In t=
he above example class 'A' is from type '</span>decltype(A(int{}))' but als=
o from type 'A', so if there is a function using it, they could either be g=
eneral for all 'A''s or only for the 'A''s with member 'T' of type 'int' li=
ke this:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(1=
87, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">Func</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">A obj</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//gener=
al function for objects of type 'A' thus inline</span></div></code></div><b=
r></div></div><div class=3D"subprettyprint" style=3D"background-color: rgb(=
250, 250, 250);"><div class=3D"prettyprint" style=3D"border: 1px solid rgb(=
187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250)=
;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" =
class=3D"styled-by-prettify">Func</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">decltype</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{}))</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> obj</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" clas=
s=3D"styled-by-prettify">//function of objects with specialized 'A' type wh=
ich left no inline members so function is not inline</span></div></code></d=
iv><br>The same applies for functions. Examples of function '<span style=3D=
"color: rgb(0, 0, 0); font-family: monospace;">func_add</span>':</div><div =
class=3D"subprettyprint" style=3D"background-color: rgb(250, 250, 250);"><b=
r></div><div class=3D"subprettyprint" style=3D"background-color: rgb(250, 2=
50, 250);"><div class=3D"subprettyprint"><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">void<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Func</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">decltype</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">func_add</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">obj</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">//general function w=
ith argument of type 'auto (&amp;)(inline typename T, T a, T b) -&gt; T', a=
s include inline members function implicit inline</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br><br></span></div></code></div><d=
iv class=3D"subprettyprint"><br><span style=3D"color: rgb(136, 0, 0); font-=
family: Arial, Helvetica, sans-serif;"><br></span></div></div><div class=3D=
"subprettyprint"><div class=3D"prettyprint" style=3D"border: 1px solid rgb(=
187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250)=
;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" =
class=3D"styled-by-prettify">Func</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">decltype</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">func_add</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(),</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">()))</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">obj</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">//function with argument of typ=
e &nbsp;'auto (&amp;)(inline typename T =3D=3D int, T a, T b) -&gt; T', no =
inline so function isn't implicit inline</span></div></code></div><span sty=
le=3D"color: rgb(136, 0, 0); font-family: Arial, Helvetica, sans-serif;"><b=
r></span><span style=3D"background-color: rgb(255, 255, 255);">I believe th=
is wasn't the clearest wrote of my life but I also believe you got the poin=
t and the benefits of including this syntax.</span><span style=3D"color: rg=
b(136, 0, 0); font-family: Arial, Helvetica, sans-serif;"><br></span></div>=
</div></div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_271_1048615353.1418737201599--
------=_Part_270_847709593.1418737201599--

.


Author: sasho648 <sasho648@mail.bg>
Date: Thu, 18 Dec 2014 11:10:10 -0800 (PST)
Raw View
------=_Part_12_1124295271.1418929810949
Content-Type: multipart/alternative;
 boundary="----=_Part_13_322009744.1418929810949"

------=_Part_13_322009744.1418929810949
Content-Type: text/plain; charset=UTF-8

Recently a new idea came up into my mind. Why don't we allow 'inline' (or
compiler known variables) to be editable, if they're declared in a function
scope (or when they're locals) ? This could enable us to write compile-time
executed loops which give us the possibility for loop unrolling. Before I
show some examples of the above, let me clarify that 'inline' declared
variables now won't be uneditable, so they are allowed only in function
definitions, globals can be only 'const inline' which means that they're
compiler-time known but not-editable. This also means that another special
class methods for 'const inline' variables should be allowed for classes.
When talking for classes I remember that in my first post wrote this "in
such methods 'this' will be inline pointer and will point to an sequenced
'inline'  array holding it's inline member objects" (talking for 'inline'
class functions), which is now false - such methods will act similar to
ones specifying 'const' objects in such way that member objects, and 'this'
pointer will became implicitly 'inline' or 'const inline', depending what
object the special method describes. Editing 'inline' variables can be done
only in control-flow, defined by other inlines. The examples:

inline int vGlobal; //error: modifiable 'inline''s can be declared only in
functions

const inline int vGlobal; //ok - 'const inline' can be global

void SpeedFunc(int (&arr)[5])
{
    for(inline size_t i(0); i < sizeof(arr) / sizeof(arr[0]); ++i) //this
loop will be evaluated at run-time

        arr[i] = 0;

    /*
    //Equivalent version of the code above, without using inlines

    arr[0] = 0;

    arr[1] = 0;

    arr[2] = 0;

    arr[3] = 0;

    arr[4] = 0;

    */
}

void WrongFunction(bool b)
{
    inline int a;

    if(b) a = 9; //illegal, the assignment of inline 'a', depends on
non-inline
}


Can somebody give an opinion about it? Does this idea worth implementing
and can it be proposed?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_13_322009744.1418929810949
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Recently a new idea came up into my mind. Why don't we all=
ow 'inline' (or compiler known variables) to be editable, if they're declar=
ed in a function scope (or when they're locals) ? This could enable us to w=
rite compile-time executed loops which give us the possibility for loop unr=
olling. Before I show some examples of the above, let me clarify that 'inli=
ne' declared variables now won't be uneditable, so they are allowed only in=
 function definitions, globals can be only 'const inline' which means that =
they're compiler-time known but not-editable. This also means that another =
special class methods for 'const inline' variables should be allowed for cl=
asses. When talking for classes I remember that in my first post wrote this=
 "in such methods 'this' will be inline pointer and will point to an sequen=
ced 'inline' &nbsp;array holding it's inline member objects" (talking for '=
inline' class functions), which is now false - such methods will act simila=
r to ones specifying 'const' objects in such way that member objects, and '=
this' pointer will became implicitly 'inline' or 'const inline', depending =
what object the special method describes.&nbsp;Editing 'inline' variables c=
an be done only in control-flow, defined by other inlines.&nbsp;The example=
s:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 18=
7, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><cod=
e class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> vGlobal</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//e=
rror: modifiable 'inline''s can be declared only in functions</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">inline</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> vGlobal</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//o=
k - 'const inline' can be global</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">SpeedFunc</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">i=
nt</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(&amp;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">arr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)[</span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">])</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> si=
ze_t i</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> i </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">sizeof</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">arr</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">/</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">sizeof</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">arr</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">[</span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">]);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">++</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">i</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">//this loop will be evaluated at run-time</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp;=
 &nbsp; &nbsp; &nbsp; arr</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">[</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">i</span><span style=3D"color: #660;" class=3D"styled-by-prettify">]</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">/*</span><span style=3D"color: #800;" class=
=3D"styled-by-prettify"><br>&nbsp; &nbsp; //Equivalent version of the code =
above, without using inlines<br><br>&nbsp; &nbsp; arr[0] =3D 0;<br><br>&nbs=
p; &nbsp; arr[1] =3D 0;<br><br>&nbsp; &nbsp; arr[2] =3D 0;<br><br>&nbsp; &n=
bsp; arr[3] =3D 0;<br><br>&nbsp; &nbsp; arr[4] =3D 0;<br><br>&nbsp; &nbsp; =
*/</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">WrongFunction</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">bool</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">if</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">b</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> a </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">9</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">//illegal, the assignment of inline=
 'a', depends on non-inline</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">}</span></div></code></div><div><br><br>Can somebody give an opi=
nion about it? Does this idea worth implementing and can it be proposed?</d=
iv></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_13_322009744.1418929810949--
------=_Part_12_1124295271.1418929810949--

.


Author: TC <rs2740@gmail.com>
Date: Thu, 18 Dec 2014 14:59:00 -0800 (PST)
Raw View
------=_Part_154_395409174.1418943541005
Content-Type: multipart/alternative;
 boundary="----=_Part_155_1327583600.1418943541006"

------=_Part_155_1327583600.1418943541006
Content-Type: text/plain; charset=UTF-8

What's the point, trying to beat the optimizer?

Loop unrolling is not necessarily a good thing (increases code size, which
in turn can cause increased cache misses). The compiler has a much better
idea about which loops should be unrolled than the programmer.

Pretty much everything being proposed in this thread provides no additional
expressiveness or efficiency; it would at most add a different way of doing
the same things we can already do now. Whether or not templates as they are
now would be adopted if we were designing a language from scratch, it will
be around for a long, long time, for compatibility reasons. The costs of
adding such a complicated feature vastly outweighs any benefit that can be
gained from it.



On Thursday, December 18, 2014 2:10:11 PM UTC-5, sasho648 wrote:
>
> Recently a new idea came up into my mind. Why don't we allow 'inline' (or
> compiler known variables) to be editable, if they're declared in a function
> scope (or when they're locals) ? This could enable us to write compile-time
> executed loops which give us the possibility for loop unrolling. Before I
> show some examples of the above, let me clarify that 'inline' declared
> variables now won't be uneditable, so they are allowed only in function
> definitions, globals can be only 'const inline' which means that they're
> compiler-time known but not-editable. This also means that another special
> class methods for 'const inline' variables should be allowed for classes.
> When talking for classes I remember that in my first post wrote this "in
> such methods 'this' will be inline pointer and will point to an sequenced
> 'inline'  array holding it's inline member objects" (talking for 'inline'
> class functions), which is now false - such methods will act similar to
> ones specifying 'const' objects in such way that member objects, and 'this'
> pointer will became implicitly 'inline' or 'const inline', depending what
> object the special method describes. Editing 'inline' variables can be done
> only in control-flow, defined by other inlines. The examples:
>
> inline int vGlobal; //error: modifiable 'inline''s can be declared only
> in functions
>
> const inline int vGlobal; //ok - 'const inline' can be global
>
> void SpeedFunc(int (&arr)[5])
> {
>     for(inline size_t i(0); i < sizeof(arr) / sizeof(arr[0]); ++i) //this
> loop will be evaluated at run-time
>
>         arr[i] = 0;
>
>     /*
>     //Equivalent version of the code above, without using inlines
>
>     arr[0] = 0;
>
>     arr[1] = 0;
>
>     arr[2] = 0;
>
>     arr[3] = 0;
>
>     arr[4] = 0;
>
>     */
> }
>
> void WrongFunction(bool b)
> {
>     inline int a;
>
>     if(b) a = 9; //illegal, the assignment of inline 'a', depends on
> non-inline
> }
>
>
> Can somebody give an opinion about it? Does this idea worth implementing
> and can it be proposed?
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_155_1327583600.1418943541006
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">What's the point, trying to beat the optimizer?<div><br></=
div><div>Loop unrolling is not necessarily a good thing (increases code siz=
e, which in turn can cause increased cache misses). The compiler has a much=
 better idea about which loops should be unrolled than the programmer.</div=
><div><br></div><div>Pretty much everything being proposed in this thread p=
rovides no additional expressiveness or efficiency; it would at most add a =
different way of doing the same things we can already do now. Whether or no=
t templates as they are now would be adopted if we were designing a languag=
e from scratch, it will be around for a long, long time, for compatibility =
reasons. The costs of adding such a complicated feature vastly outweighs an=
y benefit that can be gained from it.</div><div><div><div><br></div><div><b=
r><br>On Thursday, December 18, 2014 2:10:11 PM UTC-5, sasho648 wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Recently a new ide=
a came up into my mind. Why don't we allow 'inline' (or compiler known vari=
ables) to be editable, if they're declared in a function scope (or when the=
y're locals) ? This could enable us to write compile-time executed loops wh=
ich give us the possibility for loop unrolling. Before I show some examples=
 of the above, let me clarify that 'inline' declared variables now won't be=
 uneditable, so they are allowed only in function definitions, globals can =
be only 'const inline' which means that they're compiler-time known but not=
-editable. This also means that another special class methods for 'const in=
line' variables should be allowed for classes. When talking for classes I r=
emember that in my first post wrote this "in such methods 'this' will be in=
line pointer and will point to an sequenced 'inline' &nbsp;array holding it=
's inline member objects" (talking for 'inline' class functions), which is =
now false - such methods will act similar to ones specifying 'const' object=
s in such way that member objects, and 'this' pointer will became implicitl=
y 'inline' or 'const inline', depending what object the special method desc=
ribes.&nbsp;Editing 'inline' variables can be done only in control-flow, de=
fined by other inlines.&nbsp;The examples:<br><br><div style=3D"border:1px =
solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,25=
0)"><code><div><span style=3D"color:#008">inline</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">int</span><span style=3D"color:#0=
00"> vGlobal</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#800">//error: modifiable 'inline''s can=
 be declared only in functions</span><span style=3D"color:#000"><br><br></s=
pan><span style=3D"color:#008">const</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#008">inline</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#008">int</span><span style=3D"color:#000"> vGlobal=
</span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#800">//ok - 'const inline' can be global</span><spa=
n style=3D"color:#000"><br><br></span><span style=3D"color:#008">void</span=
><span style=3D"color:#000"> </span><span style=3D"color:#606">SpeedFunc</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#008">int</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">(&amp;</span=
><span style=3D"color:#000">arr</span><span style=3D"color:#660">)[</span><=
span style=3D"color:#066">5</span><span style=3D"color:#660">])</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span s=
tyle=3D"color:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#008">for=
</span><span style=3D"color:#660">(</span><span style=3D"color:#008">inline=
</span><span style=3D"color:#000"> size_t i</span><span style=3D"color:#660=
">(</span><span style=3D"color:#066">0</span><span style=3D"color:#660">);<=
/span><span style=3D"color:#000"> i </span><span style=3D"color:#660">&lt;<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">sizeof<=
/span><span style=3D"color:#660">(</span><span style=3D"color:#000">arr</sp=
an><span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">/</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#008">sizeof</span><span style=3D"color:#660">(</span><span s=
tyle=3D"color:#000">arr</span><span style=3D"color:#660">[</span><span styl=
e=3D"color:#066">0</span><span style=3D"color:#660">]);</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">++</span><span style=3D"=
color:#000">i</span><span style=3D"color:#660">)</span><span style=3D"color=
:#000"> </span><span style=3D"color:#800">//this loop will be evaluated at =
run-time</span><span style=3D"color:#000"><br><br>&nbsp; &nbsp; &nbsp; &nbs=
p; arr</span><span style=3D"color:#660">[</span><span style=3D"color:#000">=
i</span><span style=3D"color:#660">]</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#066">0</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"><br><br>&nbsp; &nbsp; </span><span style=3D"color:#80=
0">/*</span><span style=3D"color:#800"><br>&nbsp; &nbsp; //Equivalent versi=
on of the code above, without using inlines<br><br>&nbsp; &nbsp; arr[0] =3D=
 0;<br><br>&nbsp; &nbsp; arr[1] =3D 0;<br><br>&nbsp; &nbsp; arr[2] =3D 0;<b=
r><br>&nbsp; &nbsp; arr[3] =3D 0;<br><br>&nbsp; &nbsp; arr[4] =3D 0;<br><br=
>&nbsp; &nbsp; */</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">}</span><span style=3D"color:#000"><br><br></span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">WrongFunction</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#008">bool</span><span style=3D"color:#000"> b</span><span=
 style=3D"color:#660">)</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>&nbsp; &nbsp; </=
span><span style=3D"color:#008">inline</span><span style=3D"color:#000"> </=
span><span style=3D"color:#008">int</span><span style=3D"color:#000"> a</sp=
an><span style=3D"color:#660">;</span><span style=3D"color:#000"><br><br>&n=
bsp; &nbsp; </span><span style=3D"color:#008">if</span><span style=3D"color=
:#660">(</span><span style=3D"color:#000">b</span><span style=3D"color:#660=
">)</span><span style=3D"color:#000"> a </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">9</=
span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#800">//illegal, the assignment of inline 'a', depends=
 on non-inline</span><span style=3D"color:#000"><br></span><span style=3D"c=
olor:#660">}</span></div></code></div><div><br><br>Can somebody give an opi=
nion about it? Does this idea worth implementing and can it be proposed?</d=
iv></div></blockquote></div></div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_155_1327583600.1418943541006--
------=_Part_154_395409174.1418943541005--

.


Author: sasho648 <sasho648@mail.bg>
Date: Thu, 18 Dec 2014 16:18:13 -0800 (PST)
Raw View
------=_Part_214_836536415.1418948293890
Content-Type: multipart/alternative;
 boundary="----=_Part_215_92089996.1418948293890"

------=_Part_215_92089996.1418948293890
Content-Type: text/plain; charset=UTF-8

And how can you check compiler-known values validity at compile-time. Do
you like being notified for them as an undefined behavior after the program
starts executing. My first examples showed this very clearly.

constexpr int EvaluateSpecialArrayIndex(int a)
{ return a * sizeof(int); }

array<int, 5> arr;

cout << arr[98] << endl; //compiles just fine, and produces undefined
behavior

cout << arr[EvaluateSpecialArrayIndex(4)] << endl; //the same as above


If you call no additional functionality being able to prevent this - I
really don't know what it could be?

Allowing define-like references, that doesn't require run-time memory
allocation is not efficiency?

I believe that enabling this construct will allow us to do a lot more
powerful things, like creating types on the fly but - you don't care I
guess. Let me first give you an example. If we want to introduce a 'enum'
names ending with ascending number we could write something like:

auto CreateEnumAscendingNumber(inline std::string strNamesBase, inline int
Range) -> inline enum
{
    inline enum EnTmp;

    for(inline int i(0); i < Range; ++i)
        EnTmp += (strNamesBase + Range);

     return EnTmp;
}

Now if we need to create an enum with members "MEMBER_0", "MEMBER_1" ...
"MEMBER_10" - we can just instance the above function:

enum EN_AUTO_CREATED = CreateEnumAscendingNumber("MEMBER_", 10);

This would be very powerful and saving-time feature. For now you don't have
any other option then writing the enum yourself, by hand. This feature
can't be added in 'constexpr' functions because they aren't specialized to
execute at compile-time. Haven't I still convinced you. Do you still think
that it's just one useless feature. Then better continue write everything
by hand or use the ugly preprocessor and let your compile-time errors to
surprise you with undefined behavior at run-time - it's your choice.

Let me tell you something about templates - they have complex syntax to
follow and are hard to learn in contrast to my 'inline' variables which are
a lot simpler and just fit into any other code, unlike templates which need
an entirely different syntax to follow. I believe C++ students will learn
them easier.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_215_92089996.1418948293890
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">And how can you check compiler-known values validity at co=
mpile-time. Do you like being notified for them as an undefined behavior af=
ter the program starts executing. My first examples showed this very clearl=
y.<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 18=
7, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><cod=
e class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color:=
 rgb(0, 0, 136);"><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>constexpr</span></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">int</span></span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(102,=
 0, 102);"><span style=3D"color: #606;" class=3D"styled-by-prettify">Evalua=
teSpecialArrayIndex</span></span><span style=3D"color: rgb(102, 102, 0);"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span></span><sp=
an style=3D"color: rgb(0, 0, 136);"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">int</span></span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> a</span><span style=3D"color: rgb(102, 102, 0);"><span =
style=3D"color: #660;" class=3D"styled-by-prettify">)</span></span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span></span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color=
: #008;" class=3D"styled-by-prettify">return</span></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> a </span><span style=3D"color: rg=
b(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
*</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">sizeof</span></span><span style=3D"color: rgb(1=
02, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span></span><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">int</span></span><span style=3D"color: rg=
b(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
);</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>array</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">5</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; <br>cout </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">98</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">]</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> endl</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//compiles ju=
st fine, and produces undefined behavior</span><span style=3D"color: rgb(0,=
 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=
cout </span></span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span></span><span styl=
e=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> arr</span></span><span style=3D"color: rgb(102, 102, 0);"><span =
style=3D"color: #660;" class=3D"styled-by-prettify">[</span></span><span st=
yle=3D"color: rgb(102, 0, 102);"><span style=3D"color: #606;" class=3D"styl=
ed-by-prettify">EvaluateSpecialArrayIndex</span></span><span style=3D"color=
: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span></span><span style=3D"color: rgb(0, 102, 102);"><wbr><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">4</span></span><span style=
=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">)]</span></span><span style=3D"color: rgb(0, 0, 0);"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&lt;&lt;</span></span><span style=3D"color: rgb(0, 0, 0);"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> endl</span></span><=
span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">//the same as above</span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></div></code></div><br><br>If you call n=
o additional functionality being able to prevent this - I really don't know=
 what it could be?<div><br>Allowing define-like references, that doesn't re=
quire run-time memory allocation is not&nbsp;efficiency?</div><div><br></di=
v><div>I believe that enabling this construct will allow us to do a lot mor=
e powerful things, like creating types on the fly but - you don't care I gu=
ess. Let me first give you an example. If we want to introduce a 'enum' nam=
es ending with ascending number we could write something like:<br><br></div=
><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); =
word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">CreateEnumAscendingNumber</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">string</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
strNamesBase</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;=
" class=3D"styled-by-prettify">Range</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">-&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">inline=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">enum</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">enum</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">EnTmp</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">inl=
ine</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> i</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #=
066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> i </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Rang=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">++</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">i</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">EnTmp</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">+=3D</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">strNamesBase </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">+</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Range<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbs=
p; &nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">r=
eturn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">EnTmp</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></div></code></div><div><b=
r>Now if we need to create an enum with members "MEMBER_0", "MEMBER_1" ... =
"MEMBER_10" - we can just instance the above function:<br><br><div class=3D=
"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: bre=
ak-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"=
><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled=
-by-prettify">enum</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> EN_AUTO_CREATED </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">C=
reateEnumAscendingNumber</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by-prett=
ify">"MEMBER_"</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #066;" class=3D"styled-by-prettify">10</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v></div><div><br></div><div>This would be very powerful and saving-time fea=
ture. For now you don't have any other option then writing the enum yoursel=
f, by hand. This feature can't be added in 'constexpr' functions because th=
ey aren't specialized to execute at compile-time. Haven't I still convinced=
 you. Do you still think that it's just one useless feature. Then better co=
ntinue write everything by hand or use the ugly preprocessor and let your c=
ompile-time errors to surprise you with undefined behavior at run-time - it=
's your choice.</div><div><br></div><div>Let me tell you something about te=
mplates - they have complex syntax to follow and are hard to learn in contr=
ast to my 'inline' variables which are a lot simpler and just fit into any =
other code, unlike templates which need an entirely different syntax to fol=
low. I believe C++ students will learn them easier.</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_215_92089996.1418948293890--
------=_Part_214_836536415.1418948293890--

.


Author: TC <rs2740@gmail.com>
Date: Thu, 18 Dec 2014 16:56:03 -0800 (PST)
Raw View
------=_Part_210_273803020.1418950563155
Content-Type: multipart/alternative;
 boundary="----=_Part_211_1897385266.1418950563155"

------=_Part_211_1897385266.1418950563155
Content-Type: text/plain; charset=UTF-8



On Thursday, December 18, 2014 7:18:13 PM UTC-5, sasho648 wrote:
>
> And how can you check compiler-known values validity at compile-time. Do
> you like being notified for them as an undefined behavior after the program
> starts executing. My first examples showed this very clearly.
>
> constexpr int EvaluateSpecialArrayIndex(int a)
> { return a * sizeof(int); }
>
> array<int, 5> arr;
>
> cout << arr[98] << endl; //compiles just fine, and produces undefined
> behavior
>
> cout << arr[EvaluateSpecialArrayIndex(4)] << endl; //the same as above
>
>
> If you call no additional functionality being able to prevent this - I
> really don't know what it could be?
>

If you are really paranoid, use the tuple-like interface with std::get. I
strongly suspect that most out-of-bounds access do not use compile-time
constants anyway.


>
> Allowing define-like references, that doesn't require run-time memory
> allocation is not efficiency?
>
> I believe that enabling this construct will allow us to do a lot more
> powerful things, like creating types on the fly but - you don't care I
> guess. Let me first give you an example. If we want to introduce a 'enum'
> names ending with ascending number we could write something like:
>
> auto CreateEnumAscendingNumber(inline std::string strNamesBase, inline int
> Range) -> inline enum
> {
>     inline enum EnTmp;
>
>     for(inline int i(0); i < Range; ++i)
>         EnTmp += (strNamesBase + Range);
>
>      return EnTmp;
> }
>
> Now if we need to create an enum with members "MEMBER_0", "MEMBER_1" ...
> "MEMBER_10" - we can just instance the above function:
>
> enum EN_AUTO_CREATED = CreateEnumAscendingNumber("MEMBER_", 10);
>
>
Compile-time std::strings and number-to-string conversion? (Hint, adding an
int to a std::string doesn't do what you think it does.) Did you even think
about implementability?

Not to mention the question "why on earth would you want such an enum?" And
even if you do, you can generate such an enum in your favorite scripting
language in a few minutes in same or fewer lines of code, throw it into a
header and never have to worry about it ever again. And it would actually
play much nicely with IDEs.


> This would be very powerful and saving-time feature. For now you don't
> have any other option then writing the enum yourself, by hand. This feature
> can't be added in 'constexpr' functions because they aren't specialized to
> execute at compile-time. Haven't I still convinced you. Do you still think
> that it's just one useless feature. Then better continue write everything
> by hand or use the ugly preprocessor and let your compile-time errors to
> surprise you with undefined behavior at run-time - it's your choice.
>
>

> Let me tell you something about templates - they have complex syntax to
> follow and are hard to learn in contrast to my 'inline' variables which are
> a lot simpler and just fit into any other code, unlike templates which need
> an entirely different syntax to follow. I believe C++ students will learn
> them easier.
>

They would have to learn both the current template syntax and your invented
ones. And your syntax is neither "easier" nor "simpler" in any significant
way.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_211_1897385266.1418950563155
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, December 18, 2014 7:18:13 PM UTC-5, s=
asho648 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
>And how can you check compiler-known values validity at compile-time. Do y=
ou like being notified for them as an undefined behavior after the program =
starts executing. My first examples showed this very clearly.<br><br><div s=
tyle=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-c=
olor:rgb(250,250,250)"><code><div><span style=3D"color:rgb(0,0,136)"><span =
style=3D"color:#008">constexpr</span></span><span style=3D"color:#000"> </s=
pan><span style=3D"color:rgb(0,0,136)"><span style=3D"color:#008">int</span=
></span><span style=3D"color:#000"> </span><span style=3D"color:rgb(102,0,1=
02)"><span style=3D"color:#606">EvaluateSpecialArrayIndex</span></span><spa=
n style=3D"color:rgb(102,102,0)"><span style=3D"color:#660">(</span></span>=
<span style=3D"color:rgb(0,0,136)"><span style=3D"color:#008">int</span></s=
pan><span style=3D"color:#000"> a</span><span style=3D"color:rgb(102,102,0)=
"><span style=3D"color:#660">)</span></span><span style=3D"color:#000"><br>=
</span><span style=3D"color:rgb(102,102,0)"><span style=3D"color:#660">{</s=
pan></span><span style=3D"color:#000"> </span><span style=3D"color:rgb(0,0,=
136)"><span style=3D"color:#008">return</span></span><span style=3D"color:#=
000"> a </span><span style=3D"color:rgb(102,102,0)"><span style=3D"color:#6=
60">*</span></span><span style=3D"color:#000"> </span><span style=3D"color:=
rgb(0,0,136)"><span style=3D"color:#008">sizeof</span></span><span style=3D=
"color:rgb(102,102,0)"><span style=3D"color:#660">(</span></span><span styl=
e=3D"color:rgb(0,0,136)"><span style=3D"color:#008">int</span></span><span =
style=3D"color:rgb(102,102,0)"><span style=3D"color:#660">);</span></span><=
span style=3D"color:#000"> </span><span style=3D"color:rgb(102,102,0)"><spa=
n style=3D"color:#660">}</span><span style=3D"color:#000"><br></span></span=
><span style=3D"color:#000"><br>array</span><span style=3D"color:#660">&lt;=
</span><span style=3D"color:#008">int</span><span style=3D"color:#660">,</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#066">5</span><=
span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> arr</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br>&nbsp; &n=
bsp; <br>cout </span><span style=3D"color:#660">&lt;&lt;</span><span style=
=3D"color:#000"> arr</span><span style=3D"color:#660">[</span><span style=
=3D"color:#066">98</span><span style=3D"color:#660">]</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">&lt;&lt;</span><span style=
=3D"color:#000"> endl</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#800">//compiles just fine, an=
d produces undefined behavior</span><span style=3D"color:rgb(0,0,0)"><span =
style=3D"color:#000"><br><br>cout </span></span><span style=3D"color:rgb(10=
2,102,0)"><span style=3D"color:#660">&lt;&lt;</span></span><span style=3D"c=
olor:rgb(0,0,0)"><span style=3D"color:#000"> arr</span></span><span style=
=3D"color:rgb(102,102,0)"><span style=3D"color:#660">[</span></span><span s=
tyle=3D"color:rgb(102,0,102)"><span style=3D"color:#606">EvaluateSpecialArr=
ayIndex</span></span><span style=3D"color:rgb(102,102,0)"><span style=3D"co=
lor:#660">(</span></span><span style=3D"color:rgb(0,102,102)"><span style=
=3D"color:#066"><wbr>4</span></span><span style=3D"color:rgb(102,102,0)"><s=
pan style=3D"color:#660">)]</span></span><span style=3D"color:rgb(0,0,0)"><=
span style=3D"color:#000"> </span></span><span style=3D"color:rgb(102,102,0=
)"><span style=3D"color:#660">&lt;&lt;</span></span><span style=3D"color:rg=
b(0,0,0)"><span style=3D"color:#000"> endl</span></span><span style=3D"colo=
r:rgb(102,102,0)"><span style=3D"color:#660">;</span><span style=3D"color:#=
000"> </span><span style=3D"color:#800">//the same as above</span></span><s=
pan style=3D"color:#000"><br></span></div></code></div><br><br>If you call =
no additional functionality being able to prevent this - I really don't kno=
w what it could be?</div></blockquote><div><br></div><div>If you are really=
 paranoid, use the tuple-like interface with std::get. I strongly suspect t=
hat most out-of-bounds access do not use compile-time constants anyway.</di=
v><div>&nbsp;</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><div><br>Allowing define-like references, that doesn't require run-ti=
me memory allocation is not&nbsp;efficiency?</div><div><br></div><div>I bel=
ieve that enabling this construct will allow us to do a lot more powerful t=
hings, like creating types on the fly but - you don't care I guess. Let me =
first give you an example. If we want to introduce a 'enum' names ending wi=
th ascending number we could write something like:<br><br></div><div style=
=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-color=
:rgb(250,250,250)"><code><div><span style=3D"color:#008">auto</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#606">CreateEnumAscendingN=
umber</span><span style=3D"color:#660">(</span><span style=3D"color:#008">i=
nli<wbr>ne</span><span style=3D"color:#000"> std</span><span style=3D"color=
:#660">::</span><span style=3D"color:#008">string</span><span style=3D"colo=
r:#000"> strNamesBase</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">inline</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">int</span><span style=3D=
"color:#000"> </span><span style=3D"color:#606">Range</span><span style=3D"=
color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">-&gt;</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">inline</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">enum</span><span style=3D"color:#000"><br></span><span style=3D"color=
:#660">{</span><span style=3D"color:#000"><br>&nbsp; &nbsp; </span><span st=
yle=3D"color:#008">inline</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">enum</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#606">EnTmp</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br><br>&nbsp; &nbsp; </span><span style=3D"color:#008">for=
</span><span style=3D"color:#660">(</span><span style=3D"color:#008">inline=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> i</span><span style=3D"color:#660">(</span>=
<span style=3D"color:#066">0</span><span style=3D"color:#660">);</span><spa=
n style=3D"color:#000"> i </span><span style=3D"color:#660">&lt;</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#606">Range</span><span=
 style=3D"color:#660">;</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">++</span><span style=3D"color:#000">i</span><span style=3D=
"color:#660">)</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &n=
bsp; </span><span style=3D"color:#606">EnTmp</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#660">+=3D</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">(</span><span style=3D"color:#000">strN=
amesBase </span><span style=3D"color:#660">+</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#606">Range</span><span style=3D"color:#660=
">);</span><span style=3D"color:#000"><br><br>&nbsp; &nbsp; &nbsp;</span><s=
pan style=3D"color:#008">return</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#606">EnTmp</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"><br></span><span style=3D"color:#660">}</span></div=
></code></div><div><br>Now if we need to create an enum with members "MEMBE=
R_0", "MEMBER_1" ... "MEMBER_10" - we can just instance the above function:=
<br><br><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-wor=
d;background-color:rgb(250,250,250)"><code><div><span style=3D"color:#008">=
enum</span><span style=3D"color:#000"> EN_AUTO_CREATED </span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D=
"color:#606">CreateEnumAscendingNumber</span><span style=3D"color:#660">(</=
span><span style=3D"color:#080">"<wbr>MEMBER_"</span><span style=3D"color:#=
660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#066">=
10</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><br=
></span></div></code></div></div><div><br></div></div></blockquote><div><br=
></div><div>Compile-time std::strings and number-to-string conversion? (Hin=
t, adding an int to a std::string doesn't do what you think it does.) Did y=
ou even think about implementability?</div><div><br></div><div>Not to menti=
on the question "why on earth would you want such an enum?" And even if you=
 do, you can generate such an enum in your favorite scripting language in a=
 few minutes in same or fewer lines of code, throw it into a header and nev=
er have to worry about it ever again. And it would actually play much nicel=
y with IDEs.</div><div>&nbsp;</div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><div dir=3D"ltr"><div></div><div>This would be very powerful and savi=
ng-time feature. For now you don't have any other option then writing the e=
num yourself, by hand. This feature can't be added in 'constexpr' functions=
 because they aren't specialized to execute at compile-time. Haven't I stil=
l convinced you. Do you still think that it's just one useless feature. The=
n better continue write everything by hand or use the ugly preprocessor and=
 let your compile-time errors to surprise you with undefined behavior at ru=
n-time - it's your choice.</div><div><br></div></div></blockquote><div>&nbs=
p;</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>=
</div><div>Let me tell you something about templates - they have complex sy=
ntax to follow and are hard to learn in contrast to my 'inline' variables w=
hich are a lot simpler and just fit into any other code, unlike templates w=
hich need an entirely different syntax to follow. I believe C++ students wi=
ll learn them easier.</div></div></blockquote><div><br></div><div>They woul=
d have to learn both the current template syntax and your invented ones. An=
d your syntax is neither "easier" nor "simpler" in any significant way.&nbs=
p;</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_211_1897385266.1418950563155--
------=_Part_210_273803020.1418950563155--

.


Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Fri, 19 Dec 2014 01:04:30 +0000
Raw View
It seems there is some confusion: a function template is a SET of
functions, so should have a different syntax.

On 12/19/14, TC <rs2740@gmail.com> wrote:
>
>
> On Thursday, December 18, 2014 7:18:13 PM UTC-5, sasho648 wrote:
>>
>> And how can you check compiler-known values validity at compile-time. Do
>> you like being notified for them as an undefined behavior after the
>> program
>> starts executing. My first examples showed this very clearly.
>>
>> constexpr int EvaluateSpecialArrayIndex(int a)
>> { return a * sizeof(int); }
>>
>> array<int, 5> arr;
>>
>> cout << arr[98] << endl; //compiles just fine, and produces undefined
>> behavior
>>
>> cout << arr[EvaluateSpecialArrayIndex(4)] << endl; //the same as above
>>
>>
>> If you call no additional functionality being able to prevent this - I
>> really don't know what it could be?
>>
>
> If you are really paranoid, use the tuple-like interface with std::get. I
> strongly suspect that most out-of-bounds access do not use compile-time
> constants anyway.
>
>
>>
>> Allowing define-like references, that doesn't require run-time memory
>> allocation is not efficiency?
>>
>> I believe that enabling this construct will allow us to do a lot more
>> powerful things, like creating types on the fly but - you don't care I
>> guess. Let me first give you an example. If we want to introduce a 'enum'
>>
>> names ending with ascending number we could write something like:
>>
>> auto CreateEnumAscendingNumber(inline std::string strNamesBase, inline int
>>
>> Range) -> inline enum
>> {
>>     inline enum EnTmp;
>>
>>     for(inline int i(0); i < Range; ++i)
>>         EnTmp += (strNamesBase + Range);
>>
>>      return EnTmp;
>> }
>>
>> Now if we need to create an enum with members "MEMBER_0", "MEMBER_1" ...
>> "MEMBER_10" - we can just instance the above function:
>>
>> enum EN_AUTO_CREATED = CreateEnumAscendingNumber("MEMBER_", 10);
>>
>>
> Compile-time std::strings and number-to-string conversion? (Hint, adding an
>
> int to a std::string doesn't do what you think it does.) Did you even think
>
> about implementability?
>
> Not to mention the question "why on earth would you want such an enum?" And
>
> even if you do, you can generate such an enum in your favorite scripting
> language in a few minutes in same or fewer lines of code, throw it into a
> header and never have to worry about it ever again. And it would actually
> play much nicely with IDEs.
>
>
>> This would be very powerful and saving-time feature. For now you don't
>> have any other option then writing the enum yourself, by hand. This
>> feature
>> can't be added in 'constexpr' functions because they aren't specialized to
>>
>> execute at compile-time. Haven't I still convinced you. Do you still think
>>
>> that it's just one useless feature. Then better continue write everything
>>
>> by hand or use the ugly preprocessor and let your compile-time errors to
>> surprise you with undefined behavior at run-time - it's your choice.
>>
>>
>
>> Let me tell you something about templates - they have complex syntax to
>> follow and are hard to learn in contrast to my 'inline' variables which
>> are
>> a lot simpler and just fit into any other code, unlike templates which
>> need
>> an entirely different syntax to follow. I believe C++ students will learn
>>
>> them easier.
>>
>
> They would have to learn both the current template syntax and your invented
>
> ones. And your syntax is neither "easier" nor "simpler" in any significant
> way.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 18 Dec 2014 17:53:23 -0800
Raw View
On Thursday 18 December 2014 16:18:13 sasho648 wrote:
> constexpr int EvaluateSpecialArrayIndex(int a)
> { return a * sizeof(int); }
>
> array<int, 5> arr;
>
> cout << arr[98] << endl; //compiles just fine, and produces undefined
> behavior

How is that different from the following?

 int arr[5];
 cout << arr[98] << endl;

Both compile just fine and produce UB.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Fri, 19 Dec 2014 01:03:38 -0800 (PST)
Raw View
------=_Part_448_2009561929.1418979818723
Content-Type: multipart/alternative;
 boundary="----=_Part_449_1232024334.1418979818723"

------=_Part_449_1232024334.1418979818723
Content-Type: text/plain; charset=UTF-8

@Thiago Macieira '

It's different in that 'std::array' is a class and could provide such
constant checks for it's index, if an overload of operator[] is provided
with 'inline' argument.

*@TC*

Compile-time std::strings and number-to-string conversion? (Hint, adding an
> int to a std::string doesn't do what you think it does.) Did you even think
> about implementability?
> Not to mention the question "why on earth would you want such an enum?"
> And even if you do, you can generate such an enum in your favorite
> scripting language in a few minutes in same or fewer lines of code, throw
> it into a header and never have to worry about it ever again. And it would
> actually play much nicely with IDEs.


But you got the idea, right? The code wouldn't compile even if I have used
the proper 'string' to 'int' conversion. I don't know why everyone doesn't
care about meta-programming?

They would have to learn both the current template syntax and your invented
> ones. And your syntax is neither "easier" nor "simpler" in any significant
> way.


Really - so you're saying that this:

template<typename T, size_t sz>
void SomeFunc()
{
    T tmpArr[sz];
}

Is easier to learn with all this new syntax, including different brackets
and new keyword 'template' and that the below is harder, no matter that it
fits into previously learned about function parameters and their syntax?

void SomeFunc(inline typename T, inline size_t sz)
{
    T tmpArr[sz];
}

Ok - as you say.

@Douglas Boffey

A function template defines general functions. You're talking about
specialization, which is a different thing and as you pointed out above -
it can be replaced with just a new function.
But if you meant that 'template' are expanded, during compile-time - my
functions with 'inline' parameters or return-value will do the same.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_449_1232024334.1418979818723
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span class=3D"_username" style=3D"color: rgb(136, 136, 13=
6); line-height: 19.5px;"><span class=3D"GJHURADA0B" style=3D"color: rgb(34=
, 34, 34);">@Thiago Macieira</span></span><span style=3D"color: rgb(136, 13=
6, 136); line-height: 19.5px;">&nbsp;'</span><div><font color=3D"#888888"><=
span style=3D"line-height: 19.5px;"><br></span></font><div>It's different i=
n that 'std::array' is a class and could provide such constant checks for i=
t's index, if an overload of operator[] is provided with 'inline' argument.=
<br></div></div><div><br></div><div><b>@TC</b></div><div><br></div><div><bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-l=
eft-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: s=
olid; padding-left: 1ex;">Compile-time std::strings and number-to-string co=
nversion? (Hint, adding an int to a std::string doesn't do what you think i=
t does.) Did you even think about implementability?<br>Not to mention the q=
uestion "why on earth would you want such an enum?" And even if you do, you=
 can generate such an enum in your favorite scripting language in a few min=
utes in same or fewer lines of code, throw it into a header and never have =
to worry about it ever again. And it would actually play much nicely with I=
DEs.</blockquote><div><br></div><div>But you got the idea, right? The code =
wouldn't compile even if I have used the proper 'string' to 'int' conversio=
n. I don't know why everyone doesn't care about meta-programming?</div></di=
v><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); =
border-left-style: solid; padding-left: 1ex;">They would have to learn both=
 the current template syntax and your invented ones. And your syntax is nei=
ther "easier" nor "simpler" in any significant way.&nbsp;</blockquote><div>=
<br></div><div>Really - so you're saying that this:<br><br></div><div class=
=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: =
break-word; background-color: rgb(250, 250, 250);"><code class=3D"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t sz=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">SomeFunc</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"font-size: 13.6960000991821px; fon=
t-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'De=
jaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, seri=
f; white-space: inherit; line-height: 17.8048000335693px; background-color:=
 transparent;"></span><span style=3D"font-size: 13.6960000991821px; font-fa=
mily: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu=
 Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; w=
hite-space: inherit; line-height: 17.8048000335693px; background-color: tra=
nsparent;"><span style=3D"color: #000;" class=3D"styled-by-prettify">&nbsp;=
 &nbsp; </span></span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">T tmpArr</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">[</span><span style=3D"color: #000;" class=3D"styled-by-prettify">sz</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">];</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span></div></code></div><div><br><=
/div><div>Is easier to learn with all this new syntax, including different =
brackets and new keyword 'template' and that the below is harder, no matter=
 that it fits into previously learned about function parameters and their s=
yntax?</div><div><br></div><div><span class=3D"styled-by-prettify" style=3D=
"font-family: monospace; color: rgb(0, 0, 136); background-color: rgb(250, =
250, 250);"></span></div><div class=3D"prettyprint" style=3D"border: 1px so=
lid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 2=
50, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span =
style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">SomeFunc</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">inline</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t sz</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; T tmpArr</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">sz</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">}</span></div></code></div><div><span class=3D"styled-by=
-prettify" style=3D"font-family: monospace; color: rgb(102, 102, 0); backgr=
ound-color: rgb(250, 250, 250);"><br></span>Ok - as you say.</div><div><br>=
</div><div><span class=3D"_username" style=3D"white-space: nowrap;"><span c=
lass=3D"GJHURADA0B g-hovercard" data-userid=3D"105548083684085355974" data-=
name=3D"Douglas Boffey">@Douglas Boffey</span></span><span style=3D"white-s=
pace: nowrap;">&nbsp;</span><br></div><div><span style=3D"white-space: nowr=
ap;"><br></span></div><div><span style=3D"white-space: nowrap;">A function =
template defines general functions. You're talking about specialization, wh=
ich is a different thing and as you pointed out above - it can be replaced =
with just a new function.&nbsp;</span></div><div><span style=3D"white-space=
: nowrap;">But if you meant that 'template' are expanded, during compile-ti=
me - my functions with 'inline' parameters or return-value will do the same=
..</span></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_449_1232024334.1418979818723--
------=_Part_448_2009561929.1418979818723--

.


Author: David Krauss <potswa@gmail.com>
Date: Fri, 19 Dec 2014 17:26:00 +0800
Raw View
--Apple-Mail=_0BCB9083-0CE1-46FB-87E7-529DE8A6A45F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2014=E2=80=9312=E2=80=9319, at 5:03 PM, sasho648 <sasho648@mail.bg> wr=
ote:
>=20
> Is easier to learn with all this new syntax, including different brackets=
 and new keyword 'template' and that the below is harder, no matter that it=
 fits into previously learned about function parameters and their syntax?
>=20
> void SomeFunc(inline typename T, inline size_t sz)
> {
>     T tmpArr[sz];
> }

Just a suggestion: it might fit better with the existing language to merely=
 allow template parameters to be deduced from function parameter values. Cu=
rrently, a function parameter name is not allowed to alias a function templ=
ate parameter name. The case of aliasing could be defined as a deduced cont=
ext.

template< typename elem, std::size_t size >
void some_func( std::size_t size ) {
    std::array< elem, size > tmp;
}

some_func< int >( 3 ); // calls some_func< int, 3 >
some_func< int >( 5 ); // calls some_func< int, 5 >
int x =3D 4;
some_func< int >( x ); // error: need a constant expression
some_func< int, 5 >( 6 ); // error: mismatched values

auto * x =3D & some_fun< int, 10 >; // OK

The main downside I see is that the name in the function parameter declarat=
ion is semantically significant.

As for literal types that aren=E2=80=99t currently allowed as template non-=
type parameters, I have some faith that they=E2=80=99re on the way, at leas=
t as far as the ones for which it would make sense to instantiate such func=
tions at all.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_0BCB9083-0CE1-46FB-87E7-529DE8A6A45F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=
=E2=80=9319, at 5:03 PM, sasho648 &lt;<a href=3D"mailto:sasho648@mail.bg" c=
lass=3D"">sasho648@mail.bg</a>&gt; wrote:</div><br class=3D"Apple-interchan=
ge-newline"><div class=3D""><div style=3D"font-family: Helvetica; font-size=
: 12px; font-style: normal; font-variant: normal; font-weight: normal; lett=
er-spacing: normal; line-height: normal; orphans: auto; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; widows: auto; =
word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D"">Is easier to=
 learn with all this new syntax, including different brackets and new keywo=
rd 'template' and that the below is harder, no matter that it fits into pre=
viously learned about function parameters and their syntax?</div><div style=
=3D"font-family: Helvetica; font-size: 12px; font-style: normal; font-varia=
nt: normal; font-weight: normal; letter-spacing: normal; line-height: norma=
l; orphans: auto; text-align: start; text-indent: 0px; text-transform: none=
; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke=
-width: 0px;" class=3D""><br class=3D""></div><div style=3D"font-family: He=
lvetica; font-size: 12px; font-style: normal; font-variant: normal; font-we=
ight: normal; letter-spacing: normal; line-height: normal; orphans: auto; t=
ext-align: start; text-indent: 0px; text-transform: none; white-space: norm=
al; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=
=3D""><span class=3D"styled-by-prettify" style=3D"font-family: monospace; c=
olor: rgb(0, 0, 136); background-color: rgb(250, 250, 250);"></span></div><=
div class=3D"prettyprint" style=3D"font-family: Helvetica; font-size: 12px;=
 font-style: normal; font-variant: normal; font-weight: normal; letter-spac=
ing: normal; line-height: normal; orphans: auto; text-align: start; text-in=
dent: 0px; text-transform: none; white-space: normal; widows: auto; word-sp=
acing: 0px; -webkit-text-stroke-width: 0px; border: 1px solid rgb(187, 187,=
 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code =
class=3D"prettyprint"><span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 136);">void</span>&nbsp;<span class=3D"styled-by-prettify" style=3D=
"color: rgb(102, 0, 102);">SomeFunc</span><span class=3D"styled-by-prettify=
" style=3D"color: rgb(102, 102, 0);">(</span><span class=3D"styled-by-prett=
ify" style=3D"color: rgb(0, 0, 136);">inline</span>&nbsp;<span class=3D"sty=
led-by-prettify" style=3D"color: rgb(0, 0, 136);">typename</span><span clas=
s=3D"Apple-converted-space">&nbsp;</span>T<span class=3D"styled-by-prettify=
" style=3D"color: rgb(102, 102, 0);">,</span>&nbsp;<span class=3D"styled-by=
-prettify" style=3D"color: rgb(0, 0, 136);">inline</span><span class=3D"App=
le-converted-space">&nbsp;</span>size_t sz<span class=3D"styled-by-prettify=
" style=3D"color: rgb(102, 102, 0);">)</span><br class=3D""><span class=3D"=
styled-by-prettify" style=3D"color: rgb(102, 102, 0);">{</span><br class=3D=
"">&nbsp; &nbsp; T tmpArr<span class=3D"styled-by-prettify" style=3D"color:=
 rgb(102, 102, 0);">[</span>sz<span class=3D"styled-by-prettify" style=3D"c=
olor: rgb(102, 102, 0);">];</span><br class=3D""><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(102, 102, 0);">}</span></code></div></div></bl=
ockquote><br class=3D""></div><div>Just a suggestion: it might fit better w=
ith the existing language to merely allow template parameters to be deduced=
 from function parameter values. Currently, a function parameter name is no=
t allowed to alias a function template parameter name. The case of aliasing=
 could be defined as a deduced context.</div><br class=3D""><div class=3D""=
><font face=3D"Courier" class=3D"">template&lt; typename elem, std::size_t =
size &gt;</font></div><div class=3D""><font face=3D"Courier" class=3D"">voi=
d some_func( std::size_t size ) {</font></div><div class=3D""><font face=3D=
"Courier" class=3D"">&nbsp; &nbsp; std::array&lt; elem, size &gt; tmp;</fon=
t></div><div class=3D""><font face=3D"Courier" class=3D"">}</font></div><di=
v class=3D""><font face=3D"Courier" class=3D""><br class=3D""></font></div>=
<div class=3D""><font face=3D"Courier" class=3D"">some_func&lt; int &gt;( 3=
 ); // calls some_func&lt; int, 3 &gt;</font></div><div class=3D""><div cla=
ss=3D""><font face=3D"Courier" class=3D"">some_func&lt; int &gt;( 5 ); // c=
alls some_func&lt; int, 5 &gt;</font></div></div><div class=3D""><font face=
=3D"Courier" class=3D"">int x =3D 4;</font></div><div class=3D""><font face=
=3D"Courier" class=3D"">some_func&lt; int &gt;( x ); // error: need a const=
ant expression</font></div><div class=3D""><font face=3D"Courier" class=3D"=
">some_func&lt; int, 5 &gt;( 6 ); // error: mismatched values</font></div><=
div class=3D""><font face=3D"Courier" class=3D""><br class=3D""></font></di=
v><div class=3D""><font face=3D"Courier" class=3D"">auto * x =3D &amp;&nbsp=
;some_fun&lt; int, 10 &gt;; // OK</font></div><div class=3D""><br class=3D"=
"></div><div class=3D"">The main downside I see is that the name in the fun=
ction parameter declaration is semantically significant.</div><div class=3D=
""><br class=3D""></div><div class=3D"">As for literal types that aren=E2=
=80=99t currently allowed as template non-type parameters, I have some fait=
h that they=E2=80=99re on the way, at least as far as the ones for which it=
 would make sense to instantiate such functions at all.</div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_0BCB9083-0CE1-46FB-87E7-529DE8A6A45F--

.


Author: sasho648 <sasho648@mail.bg>
Date: Fri, 19 Dec 2014 01:53:46 -0800 (PST)
Raw View
------=_Part_460_1728387166.1418982826677
Content-Type: multipart/alternative;
 boundary="----=_Part_461_2139289640.1418982826677"

------=_Part_461_2139289640.1418982826677
Content-Type: text/plain; charset=UTF-8

And what's the benefit from this suggestion as we still can't distinguish
lvalues and compiler-constants, or did you have some other intend in mind?
In every case if you meant the first we can't overload with non-template
functions as it'll fully replace the template ones. Example:

template< std::size_t size >
void some_func( std::size_t size ) {
    static_assert(size < 10, "invalid size");

}

void some_func( std::size_t size ) {
    //Do Something with size
}

int x = 4;

some_func(9); //calls some_func( std::size_t size )

some_func(x); //same as above

Otherwise I would say that 'template' deduction at all is one bad joke. It
deduces the type of some template argument by using an argument depending
on it, which I believe is one infinitive loop (if not being badly
interpreted by ISO C++). Example

template<typename T>
void Func(T a);

Func(9);


Here is how I interpret the above example:

Template parameter 'T' will be deduced from parameter 'a' type which is 'T'
which will be deduced from parameter 'a' type... and etc. It's really
non-sense. But fortunate the 'auto' keyword was added which probably in
C++14 will allow this (a lot more sensitive):

void Func(auto a);

Func(9); //'a' type is deduced from the passed argument

At least something good to be added in ISO C++.

But let's talk about my proposal.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_461_2139289640.1418982826677
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">And what's the benefit from this suggestion as we still ca=
n't distinguish lvalues and compiler-constants, or did you have some other =
intend in mind? In every case if you meant the first we can't overload with=
 non-template functions as it'll fully replace the template ones. Example:<=
br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, =
187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code c=
lass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">template</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">size_t size </span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> som=
e_func</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">size_t size </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">static_assert</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">size </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">10</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #080;" class=3D"styled-by-prettify">"invalid size"</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> some_func</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">size_t size </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbs=
p; </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//Do So=
mething with size</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>}</span></div></code></div><div><div><font face=3D"Courier"><br></font></d=
iv></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> x </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">4</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>so=
me_func</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #066;" class=3D"styled-by-prettify">9</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//calls some_func( std::size_t size )=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>so=
me_func</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">x</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//same as above</span></div></code></=
div><div><span style=3D"color: rgb(0, 0, 0); font-family: monospace; backgr=
ound-color: rgb(250, 250, 250);"><br></span></div><div><span style=3D"color=
: rgb(0, 0, 0); font-family: monospace; background-color: rgb(250, 250, 250=
);">Otherwise I would say that 'template' deduction at all is one bad joke.=
 It deduces the type of some template argument by using an argument dependi=
ng on it, which I believe is one&nbsp;</span><span style=3D"background-colo=
r: rgb(250, 250, 250);"><font color=3D"#000000" face=3D"monospace">infiniti=
ve&nbsp;loop (if not being badly interpreted by ISO C++). Example<br><br></=
font></span></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb=
(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250=
);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">void</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">Func</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">T a</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Func</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066=
;" class=3D"styled-by-prettify">9</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span></div></code></div><div><span style=3D"bac=
kground-color: rgb(250, 250, 250);"><font color=3D"#000000" face=3D"monospa=
ce"><br></font></span></div><div><span style=3D"background-color: rgb(250, =
250, 250);"><font color=3D"#000000" face=3D"monospace"><br></font></span></=
div><div><span style=3D"background-color: rgb(250, 250, 250);"><font color=
=3D"#000000" face=3D"monospace">Here is how I&nbsp;interpret&nbsp;the above=
 example:</font></span></div><div><span style=3D"font-family: Courier;"><br=
></span></div><div><font face=3D"Courier">Template parameter 'T' will be de=
duced from parameter 'a' type which is 'T' which will be deduced from&nbsp;=
</font><span style=3D"font-family: Courier;">parameter 'a' type... and etc.=
 It's really non-sense. But&nbsp;</span><font face=3D"Courier">fortunate th=
e 'auto' keyword was added which probably in C++14 will allow this (a lot m=
ore sensitive):<br><br></font><span class=3D"styled-by-prettify" style=3D"f=
ont-family: monospace; color: rgb(0, 0, 136); background-color: rgb(250, 25=
0, 250);"></span></div><div class=3D"prettyprint" style=3D"border: 1px soli=
d rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250=
, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">Func</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> a</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r><br></span><span style=3D"color: #606;" class=3D"styled-by-prettify">Func=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #066;" class=3D"styled-by-prettify">9</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">//'a' type is deduced from the passed argumen=
t</span></div></code></div><div><span class=3D"styled-by-prettify" style=3D=
"font-family: monospace; background-color: rgb(250, 250, 250);"><span class=
=3D"styled-by-prettify"><br><font color=3D"#000000">At least something good=
 to be added in ISO C++.</font></span><font color=3D"#000000"><br></font></=
span></div><div><span class=3D"styled-by-prettify" style=3D"font-family: mo=
nospace; background-color: rgb(250, 250, 250);"><span class=3D"styled-by-pr=
ettify"><font color=3D"#000000"><br></font></span></span></div><div><span c=
lass=3D"styled-by-prettify" style=3D"font-family: monospace; background-col=
or: rgb(250, 250, 250);"><span class=3D"styled-by-prettify"><font color=3D"=
#000000">But let's talk about my proposal.</font></span></span></div><div><=
br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_461_2139289640.1418982826677--
------=_Part_460_1728387166.1418982826677--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 19 Dec 2014 12:12:39 +0200
Raw View
On 19 December 2014 at 11:26, David Krauss <potswa@gmail.com> wrote:
> Just a suggestion: it might fit better with the existing language to merely
> allow template parameters to be deduced from function parameter values.
> Currently, a function parameter name is not allowed to alias a function
> template parameter name. The case of aliasing could be defined as a deduced
> context.
> template< typename elem, std::size_t size >
> void some_func( std::size_t size ) {
>     std::array< elem, size > tmp;
> }

This seems quite related to
http://cplusplus.github.io/EWG/ewg-closed.html#31

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: David Krauss <potswa@gmail.com>
Date: Fri, 19 Dec 2014 23:13:27 +0800
Raw View
--Apple-Mail=_44EC72E3-61BF-415C-87D8-38FF8C1419FF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2014=E2=80=9312=E2=80=9319, at 6:12 PM, Ville Voutilainen <ville.vouti=
lainen@gmail.com> wrote:
>=20
> On 19 December 2014 at 11:26, David Krauss <potswa@gmail.com> wrote:
>> template< typename elem, std::size_t size >
>> void some_func( std::size_t size ) {
>>    std::array< elem, size > tmp;
>> }
>=20
> This seems quite related to
> http://cplusplus.github.io/EWG/ewg-closed.html#31 <http://cplusplus.githu=
b.io/EWG/ewg-closed.html#31>

I=E2=80=99m happy with that general direction, too.

I guess we will continue to see such proposals get shot down. It=E2=80=99s =
really just a matter of educating folks about function template parameters.=
 FWIW, std::integral_constant is a fair workaround for avoiding explicit te=
mplate argument lists.


> On 2014=E2=80=9312=E2=80=9319, at 5:53 PM, sasho648 <sasho648@mail.bg> wr=
ote:
>=20
> And what's the benefit from this suggestion as we still can't distinguish=
 lvalues and compiler-constants,=20

Value category is unrelated to compile-time determination. A constexpr obje=
ct is an lvalue with a compile-time value. The result of an arithmetic oper=
ation is an rvalue with a runtime value. We can discriminate on value categ=
ory using forwarding references. Discriminating compile-time from runtime e=
valuation is a recipe for unmaintainable code. You don=E2=80=99t want to be=
 writing functions twice and maintaining them in parallel.

> or did you have some other intend in mind?

Feasibility? Ability to reason about function identity?

> In every case if you meant the first we can't overload with non-template =
functions as it'll fully replace the template ones. Example:
>=20
> template< std::size_t size >
> void some_func( std::size_t size ) {
>     static_assert(size < 10, "invalid size");
>=20
> }
>=20
> void some_func( std::size_t size ) {
>     //Do Something with size
> }
>=20
> int x =3D 4;
>=20
> some_func(9); //calls some_func( std::size_t size )
>=20
> some_func(x); //same as above

I never mentioned rules that would make it so. You=E2=80=99re just inventin=
g problems to avoid adopting someone else=E2=80=99s idea.

If you want that example to work, just say that the template can be chosen =
in the first instance because it=E2=80=99s more specialized than the non-te=
mplate function. In the second instance, the template is not viable so it c=
an be ignored.

> Template parameter 'T' will be deduced from parameter 'a' type which is '=
T' which will be deduced from parameter 'a' type... and etc. It's really no=
n-sense. But fortunate the 'auto' keyword was added which probably in C++14=
 will allow this (a lot more sensitive):

C++14 is already standardized. (Note, there are less than two weeks remaini=
ng in 2014.)

> void Func(auto a);
>=20
> Func(9); //'a' type is deduced from the passed argument
>=20
> At least something good to be added in ISO C++.

This is scheduled for the Modules TS if I heard right. It=E2=80=99s shortha=
nd for your previous example and it makes exactly the same degree of sense.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_44EC72E3-61BF-415C-87D8-38FF8C1419FF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=
=E2=80=9319, at 6:12 PM, Ville Voutilainen &lt;<a href=3D"mailto:ville.vout=
ilainen@gmail.com" class=3D"">ville.voutilainen@gmail.com</a>&gt; wrote:</d=
iv><br class=3D"Apple-interchange-newline"><div class=3D"">On 19 December 2=
014 at 11:26, David Krauss &lt;<a href=3D"mailto:potswa@gmail.com" class=3D=
"">potswa@gmail.com</a>&gt; wrote:<br class=3D""><blockquote type=3D"cite" =
class=3D"">template&lt; typename elem, std::size_t size &gt;<br class=3D"">=
void some_func( std::size_t size ) {<br class=3D""> &nbsp;&nbsp;&nbsp;std::=
array&lt; elem, size &gt; tmp;<br class=3D"">}<br class=3D""></blockquote><=
br class=3D"">This seems quite related to<br class=3D""><a href=3D"http://c=
plusplus.github.io/EWG/ewg-closed.html#31" class=3D"">http://cplusplus.gith=
ub.io/EWG/ewg-closed.html#31</a><br class=3D""></div></blockquote></div><br=
 class=3D""><div class=3D"">I=E2=80=99m happy with that general direction, =
too.</div><div class=3D""><br class=3D""></div><div class=3D"">I guess we w=
ill continue to see such proposals get shot down. It=E2=80=99s really just =
a matter of educating folks about function template parameters. FWIW, <font=
 face=3D"Courier" class=3D"">std::integral_constant</font> is a fair workar=
ound for avoiding explicit template argument lists.</div><div class=3D""><b=
r class=3D""></div><div class=3D""><br class=3D""></div><div class=3D""><bl=
ockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=E2=80=
=9319, at 5:53 PM, sasho648 &lt;<a href=3D"mailto:sasho648@mail.bg" class=
=3D"">sasho648@mail.bg</a>&gt; wrote:</div><br class=3D"Apple-interchange-n=
ewline"><div class=3D""><div dir=3D"ltr" class=3D"">And what's the benefit =
from this suggestion as we still can't distinguish lvalues and compiler-con=
stants,&nbsp;</div></div></blockquote><div><br class=3D""></div><div>Value =
category is unrelated to compile-time determination. A constexpr object is =
an lvalue with a compile-time value. The result of an arithmetic operation =
is an rvalue with a runtime value. We can discriminate on value category us=
ing forwarding references. Discriminating compile-time from runtime evaluat=
ion is a recipe for unmaintainable code. You don=E2=80=99t want to be writi=
ng functions twice and maintaining them in parallel.</div><br class=3D""><b=
lockquote type=3D"cite" class=3D""><div dir=3D"ltr" class=3D"">or did you h=
ave some other intend in mind?</div></blockquote><div><br class=3D""></div>=
<div>Feasibility? Ability to reason about function identity?</div><br class=
=3D""><blockquote type=3D"cite" class=3D""><div dir=3D"ltr" class=3D"">In e=
very case if you meant the first we can't overload with non-template functi=
ons as it'll fully replace the template ones. Example:<br class=3D""><br cl=
ass=3D""><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code=
 class=3D"prettyprint"><span class=3D"styled-by-prettify" style=3D"color: r=
gb(0, 0, 136);">template</span><span class=3D"styled-by-prettify" style=3D"=
color: rgb(102, 102, 0);">&lt;</span>&nbsp;std<span class=3D"styled-by-pret=
tify" style=3D"color: rgb(102, 102, 0);">::</span>size_t size&nbsp;<span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&gt;</span><b=
r class=3D""><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 1=
36);">void</span>&nbsp;some_func<span class=3D"styled-by-prettify" style=3D=
"color: rgb(102, 102, 0);">(</span>&nbsp;std<span class=3D"styled-by-pretti=
fy" style=3D"color: rgb(102, 102, 0);">::</span>size_t size&nbsp;<span clas=
s=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">)</span>&nbsp;<=
span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">{</spa=
n><br class=3D"">&nbsp; &nbsp;&nbsp;<span class=3D"styled-by-prettify" styl=
e=3D"color: rgb(0, 0, 136);">static_assert</span><span class=3D"styled-by-p=
rettify" style=3D"color: rgb(102, 102, 0);">(</span>size&nbsp;<span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&lt;</span>&nbsp=
;<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 102, 102);">10</=
span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">=
,</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 136=
, 0);">"invalid size"</span><span class=3D"styled-by-prettify" style=3D"col=
or: rgb(102, 102, 0);">);</span><br class=3D""><br class=3D""><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">}</span><br clas=
s=3D""><br class=3D""><span class=3D"styled-by-prettify" style=3D"color: rg=
b(0, 0, 136);">void</span>&nbsp;some_func<span class=3D"styled-by-prettify"=
 style=3D"color: rgb(102, 102, 0);">(</span>&nbsp;std<span class=3D"styled-=
by-prettify" style=3D"color: rgb(102, 102, 0);">::</span>size_t size&nbsp;<=
span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">)</spa=
n>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0)=
;">{</span><br class=3D"">&nbsp; &nbsp;&nbsp;<span class=3D"styled-by-prett=
ify" style=3D"color: rgb(136, 0, 0);">//Do Something with size</span><br cl=
ass=3D""><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0=
);">}</span></code></div><div class=3D""><div class=3D""><font face=3D"Cour=
ier" class=3D""><br class=3D""></font></div></div><div class=3D"prettyprint=
" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; bac=
kground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">int</span>&nbsp;x&=
nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">=
=3D</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 1=
02, 102);">4</span><span class=3D"styled-by-prettify" style=3D"color: rgb(1=
02, 102, 0);">;</span><br class=3D""><br class=3D"">some_func<span class=3D=
"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">(</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 102, 102);">9</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">);</span>&nbs=
p;<span class=3D"styled-by-prettify" style=3D"color: rgb(136, 0, 0);">//cal=
ls some_func( std::size_t size )</span><br class=3D""><br class=3D"">some_f=
unc<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">(<=
/span>x<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);=
">);</span>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(136=
, 0, 0);">//same as above</span></code></div></div></blockquote><div><br cl=
ass=3D""></div><div>I never mentioned rules that would make it so. You=E2=
=80=99re just inventing problems to avoid adopting someone else=E2=80=99s i=
dea.</div><div><br class=3D""></div><div>If you want that example to work, =
just say that the template can be chosen in the first instance because it=
=E2=80=99s more specialized than the non-template function. In the second i=
nstance, the template is not viable so it can be ignored.</div><br class=3D=
""><blockquote type=3D"cite" class=3D""><div dir=3D"ltr" class=3D""><div cl=
ass=3D""><font face=3D"Courier" class=3D"">Template parameter 'T' will be d=
educed from parameter 'a' type which is 'T' which will be deduced from&nbsp=
;</font><span class=3D"" style=3D"font-family: Courier;">parameter 'a' type=
.... and etc. It's really non-sense. But&nbsp;</span><font face=3D"Courier" =
class=3D"">fortunate the 'auto' keyword was added which probably in C++14 w=
ill allow this (a lot more sensitive):</font></div></div></blockquote><div>=
<br class=3D""></div><div>C++14 is already standardized. (Note, there are l=
ess than two weeks remaining in 2014.)</div><br class=3D""><blockquote type=
=3D"cite" class=3D""><div dir=3D"ltr" class=3D""><div class=3D""><span clas=
s=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, =
136); background-color: rgb(250, 250, 250);"></span></div><div class=3D"pre=
ttyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-w=
ord; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><sp=
an class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">void</span=
>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 0, 102);=
">Func</span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 10=
2, 0);">(</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0=
, 136);">auto</span>&nbsp;a<span class=3D"styled-by-prettify" style=3D"colo=
r: rgb(102, 102, 0);">);</span><br class=3D""><br class=3D""><span class=3D=
"styled-by-prettify" style=3D"color: rgb(102, 0, 102);">Func</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">(</span><span=
 class=3D"styled-by-prettify" style=3D"color: rgb(0, 102, 102);">9</span><s=
pan class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">);</spa=
n>&nbsp;<span class=3D"styled-by-prettify" style=3D"color: rgb(136, 0, 0);"=
>//'a' type is deduced from the passed argument</span></code></div><div cla=
ss=3D""><span class=3D"styled-by-prettify" style=3D"font-family: monospace;=
 background-color: rgb(250, 250, 250);"><span class=3D"styled-by-prettify">=
<br class=3D""><font class=3D"">At least something good to be added in ISO =
C++.</font></span><font class=3D""><br class=3D""></font></span></div></div=
></blockquote><div><br class=3D""></div><div>This is scheduled for the Modu=
les TS if I heard right. It=E2=80=99s shorthand for your previous example a=
nd it makes exactly the same degree of sense.</div></div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_44EC72E3-61BF-415C-87D8-38FF8C1419FF--

.


Author: ville.voutilainen@gmail.com
Date: Fri, 19 Dec 2014 15:29:49 +0000
Raw View

On Fri Dec 19 2014 17:13:27 GMT+0200 (EET), David Krauss wrote:
>

=20
> > On 2014=E2=80=9312=E2=80=9319, at 6:12 PM, Ville Voutilainen <ville.vou=
tilainen@gmail.com> wrote:
> >=20
> > On 19 December 2014 at 11:26, David Krauss <potswa@gmail.com> wrote:=20
> > void Func(auto a);
> >=20
> > Func(9); //'a' type is deduced from the passed argument
> >=20
> > At least something good to be added in ISO C++.
>=20
> This is scheduled for the Modules TS if I heard right. It=E2=80=99s short=
hand for your previous example and it makes exactly the same degree of sens=
e.
>=20

Minor correction: Concepts TS, not modules.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 19 Dec 2014 09:48:35 -0800
Raw View
On Friday 19 December 2014 23:13:27 David Krauss wrote:
> Discriminating compile-time from runtime evaluation is a recipe for
> unmaintainable code. You don=E2=80=99t want to be writing functions twice=
 and
> maintaining them in parallel.

Yes, we do. Granted, for a handful of functions, but we do.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Fri, 19 Dec 2014 10:05:09 -0800 (PST)
Raw View
------=_Part_784_1112861576.1419012310134
Content-Type: multipart/alternative;
 boundary="----=_Part_785_1429426109.1419012310134"

------=_Part_785_1429426109.1419012310134
Content-Type: text/plain; charset=UTF-8

@Thiago Macieira

Thanks for the support - I was really starting to think that everybody here
are mentally sick. Thank you again.


@All other

You don't care that my construction is twice as easy to use and understand
than 'template''s and 'constexpr''s. You don't care it helps solving one
very big problem (static checks for function parameters).
You don't care it could safe you hand-writing code. You don't care that it
could help explicitly optimizing some code. All you care for is one rubbish
idea written for 2mins which doesn't add anything. Tell me,
David Krauss, how your genius idea helps us, what the heck is have in
common with my proposal?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_785_1429426109.1419012310134
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span class=3D"_username" style=3D"white-space: nowrap;"><=
span class=3D"GJHURADA0B">@Thiago Macieira</span></span><span style=3D"whit=
e-space: nowrap;">&nbsp;</span><div><span style=3D"white-space: nowrap;"><b=
r></span></div><div><span style=3D"white-space: nowrap;">Thanks for the sup=
port - I was really starting to think that everybody here are mentally sick=
.. Thank you again.<br><br><br></span><span style=3D"font-weight: bold; whit=
e-space: nowrap;">@All other<br></span><span style=3D"white-space: nowrap;"=
><br></span><span style=3D"white-space: nowrap;">You don't care that my con=
struction is twice as easy to use and understand than 'template''s and 'con=
stexpr''s. You don't care it helps solving one very big problem (static che=
cks for function parameters).<br>You don't care it could safe you hand-writ=
ing code. You don't care that it could help explicitly optimizing some code=
.. All you care for is one rubbish idea written for 2mins which doesn't add =
anything. Tell me,</span></div><div><span style=3D"font-weight: bold; white=
-space: nowrap;">David Krauss,&nbsp;</span><span style=3D"white-space: nowr=
ap;">how your genius idea helps us, what the heck is have in common with my=
 proposal?</span><br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_785_1429426109.1419012310134--
------=_Part_784_1112861576.1419012310134--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 19 Dec 2014 20:12:52 +0200
Raw View
On 19 December 2014 at 20:05, sasho648 <sasho648@mail.bg> wrote:
> @Thiago Macieira
>
> Thanks for the support - I was really starting to think that everybody here
> are mentally sick. Thank you again.

Ah, one of those again. In case your ultimate goal is to make sure
your writings are not
taken seriously, I should report that thus far you're succeeding magnificently.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Fri, 19 Dec 2014 10:18:55 -0800 (PST)
Raw View
------=_Part_814_729276311.1419013135895
Content-Type: multipart/alternative;
 boundary="----=_Part_815_1257785548.1419013135895"

------=_Part_815_1257785548.1419013135895
Content-Type: text/plain; charset=UTF-8

Ah, can you please not post here - if you have nothing to say about my
proposal.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_815_1257785548.1419013135895
Content-Type: text/html; charset=UTF-8

<div dir="ltr">Ah, can you please not post here - if you have nothing to say about my proposal.</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_815_1257785548.1419013135895--
------=_Part_814_729276311.1419013135895--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 19 Dec 2014 20:23:23 +0200
Raw View
On 19 December 2014 at 20:18, sasho648 <sasho648@mail.bg> wrote:
> Ah, can you please not post here - if you have nothing to say about my
> proposal.

I haven't seen a proposal yet. A proposal has design rationale and motivation,
and assesses the overall fitting of the extension into the existing language
design, considers implementability, and explains why the extension is
superior to its alternatives. A proposal also does that without
flinging excrement
and making unfounded statements about the mental health of people much
wiser than you.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Fri, 19 Dec 2014 10:37:03 -0800 (PST)
Raw View
------=_Part_286_320533992.1419014223861
Content-Type: multipart/alternative;
 boundary="----=_Part_287_1325816868.1419014223861"

------=_Part_287_1325816868.1419014223861
Content-Type: text/plain; charset=UTF-8

A proposal have those things after being boiled-down. Here we are just
discussing it. My motivation was mentioned more than twice in this
discussion. It seems however that you can't figure out arguments against it
other than that 'why we need to easy our lives by skip writing some code?',
'why do we need an easy way of writing 'general functions'?', 'why do we
need to optimize some programs as compiler does just fine?' (as I clearly
showed an example where it doesn't), 'why do we need to detect program
errors at compile-time as UB in run-time is just fine?'.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_287_1325816868.1419014223861
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">A proposal have those things after being boiled-down. Here=
 we are just discussing it. My motivation was mentioned more than twice in =
this discussion. It seems however that you can't figure out arguments again=
st it other than that 'why we need to easy our lives by skip writing some c=
ode?', 'why do we need an easy way of writing 'general functions'?', 'why d=
o we need to optimize some programs as compiler does just fine?' (as I clea=
rly showed an example where it doesn't), 'why do we need to detect program =
errors at compile-time as UB in run-time is just fine?'.</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_287_1325816868.1419014223861--
------=_Part_286_320533992.1419014223861--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 19 Dec 2014 20:43:47 +0200
Raw View
On 19 December 2014 at 20:37, sasho648 <sasho648@mail.bg> wrote:
> A proposal have those things after being boiled-down. Here we are just
> discussing it. My motivation was mentioned more than twice in this
> discussion. It seems however that you can't figure out arguments against it
> other than that 'why we need to easy our lives by skip writing some code?',
> 'why do we need an easy way of writing 'general functions'?', 'why do we
> need to optimize some programs as compiler does just fine?' (as I clearly
> showed an example where it doesn't), 'why do we need to detect program
> errors at compile-time as UB in run-time is just fine?'.

Well, if you want to actually write a proposal, it seems you should answer those
questions in your proposal.

It's not about whether we can or cannot figure out arguments against
the proposal.
The proposal must explain why it should be adopted, or even considered.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 19 Dec 2014 10:52:19 -0800
Raw View
On Friday 19 December 2014 10:05:09 sasho648 wrote:
> You don't care that my construction is twice as easy to use and understand
> than 'template''s and 'constexpr''s. You don't care it helps solving one
> very big problem (static checks for function parameters).

If it were twice as easy, we would care. It's not twice as easy to understand.
First it seemed like you wanted to do something in-between constexpr and
runtime, then you started adding new syntax, inline typename, etc. and
modifying the program's structures like creating new enum types. That's not
easier, that *more* *complex* than existing solutions.

And moreover, you have not described fully what you want. Break it down into
its component parts, describe the syntax, where it would exist, etc.

And do not insult people. You will only get ignored if you insult people.
Assume everyone in this list is smarter than you and write accordingly. Treat
their replies as decent and honest requests for more information and feedback
on your solution.

> You don't care it could safe you hand-writing code. You don't care that it
> could help explicitly optimizing some code. All you care for is one rubbish
> idea written for 2mins which doesn't add anything. Tell me,
> David Krauss, how your genius idea helps us, what the heck is have in
> common with my proposal?

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Fri, 19 Dec 2014 13:54:48 -0800 (PST)
Raw View
------=_Part_986_907668407.1419026088941
Content-Type: multipart/alternative;
 boundary="----=_Part_987_1606571808.1419026088941"

------=_Part_987_1606571808.1419026088941
Content-Type: text/plain; charset=UTF-8

Haven't I explained yet. It seems I have to write my motivation on every
second post. Here we go again.


   1. Preventing UB at run-time by reporting invalid parameters at
   compile-time.

   Imagine we have a 'Matrix' class with constructor taking 2 parameters -
   x and y. We don't want our 'Matrix' objects to have zero dimensions, so we
   must restrict the parameter values somehow. For now this is only possible
   by using 'if' statements but they're evaluated at run-time. Since our
   matrices can be created both by compiler-known values and variables we
   can't use templates. Illustration:

   class Matrix
   {
       int x_size;
       int y_size;


   public:
       Matrix(int width, int height):
           x_size{width},
           y_size{height}
       { if(!x_size || !y_size) throw; }
       Matrix() = delete;
   };


   The problem of the above class is the error reporting for invalid
   compiler-known constructor parameters which happens later at run-time, if
   the function is ever instanced on the platform you're testing. It's been
   addressed long-time and partial solution is provided by using the
   preprocessor
   <http://www.codeproject.com/Articles/8293/Design-by-Contract-in-C>.

   Example:

   Matrix a(0, 0); //wouldn't report compiler error but instead will fail
   at run-time

   int i, j;

   Matrix a1(j, i); //showing that constructor would take variables too


   The lack of detecting such compiler-time known errors is shown best by
   the 'std::array' class:

   array<int, 5> arr;

   cout << arr[98] << endl; //compiles without error


   2. Avoid reserving memory for struct members which reference compiler
   known variables locations.

   Imagine a class with a member array of some complex structure, as each
   of it's elements have some pre-defined meaning and we want to direct access
   some of it's element structure member. For the purpose we decide to create
   a reference to the desired location:


   struct B;

   struct S {

       B arr[5];

       int &NumberOfSomething = arr[3].FieldName;
   };

   Each object created with the above structure will allocate space to
   store the reference 'NumberOfSomething', no matter that the location of the
   referenced object can be calculated at compile-time ('arr[3].FieldName').

   Life example <http://melpon.org/wandbox/permlink/UviWmfFquWOLuoJB>.

The solution of the above problems is adding a new variable specifier -
'inline'. It will specify that the variable value is compiler-known and no
run-time is allocated for them. Such variables can be assigned only by
other variables with the same specifier or literals. Operations on such
variables will be executed at compile-time. They can be declared 'const'
which means that are un-editable after initialization. Only such (declared
as 'const') can be declared in the global space. Functions parameter or
return-value can also be declared as 'inline' in which case the function
itself will became implicitly inline and each instance of it should be
evaluated at compile-time. Inline variables can name a type if they are
declared with 'class', in which case they can be used as a type in
declarations.

As a solution for the second problem I suggest inline references. They have
the same rules as normal inlines with the exception that can't be assigned
literals but object names.

So the first problem can be solved like:

class Matrix
{
    int x_size;
    int y_size;


public:
    Matrix(int width, int height):
        x_size{width},
        y_size{height}
    { if(!x_size || !y_size) throw; }

    Matrix(const inline int width, const inline int height) : //overload of
'Matrix' constructor for inline variables
        x_size{width},
        y_size{height}
    {
        if(!x_size || !y_size) //checking for parameters validity done at
compile-time
            static_assert(false, "Invalid width & height parameters.");
    }

    Matrix() = delete;
};


If we now instance 'Matrix' like this:

Matrix a(0, 0);

Our constructor overload with inline parameters will be executed, reporting
compiler error.

And the second problem can be solved like:


struct B;

struct S {

    B arr[5];

    int & inline NumberOfSomething = arr[3].FieldName;
};

In which case in instances of 'B' inline reference 'NumberOfSomething' will
be created with object name 'arr[3].FieldName', without allocating memory
for it. Accessing it will be equal to accessing 'arr[3].FieldName'.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_987_1606571808.1419026088941
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Haven't I explained yet. It seems I have to write my motiv=
ation on every second post. Here we go again.<br><br><ol><li><span style=3D=
"line-height: normal;">Preventing UB at run-time by reporting invalid param=
eters at compile-time.</span><br><br><span style=3D"line-height: normal;">I=
magine we have a 'Matrix' class with constructor taking 2 parameters - x an=
d y. We don't want our 'Matrix' objects to have zero dimensions, so we must=
 restrict the parameter values somehow. For now this is only possible by us=
ing 'if' statements but they're evaluated at run-time. Since our matrices c=
an be created both by compiler-known values and variables we can't use temp=
lates. Illustration:</span><br><br><div class=3D"prettyprint" style=3D"bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: =
rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettypri=
nt"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Matrix</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> x_size</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> y_size</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br><br><br></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">public</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
&nbsp; &nbsp; </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">Matrix</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> width</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> height</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">):</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; x_size</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">width</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">},</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; y_size</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">height</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">if</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(!</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">x_size </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">||</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">!</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">y_size</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">throw</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>&nbsp; &nbsp; </span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">Matrix</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">delete</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span></div></code></div><br><br><span style=3D"li=
ne-height: normal;">The problem of the above class is the error reporting f=
or invalid compiler-known constructor parameters which happens later at run=
-time, if the function is ever instanced on the platform you're testing. It=
's been addressed long-time and partial solution is provided by using the <=
a href=3D"http://www.codeproject.com/Articles/8293/Design-by-Contract-in-C"=
>preprocessor</a>.<br></span><br>Example:<br><br><div class=3D"prettyprint"=
 style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; back=
ground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">Matrix</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><=
span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;"=
 class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">//wouldn't report compiler error but instead will fail at run-time</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> i</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> j</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br></span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Matrix</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> a1</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><font color=3D"#006666"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">j</span></font><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> i</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">//showing that co=
nstructor would take variables too</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></div></code></div><br><br>The lack of d=
etecting such compiler-time known errors is shown best by the 'std::array' =
class:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187=
, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">array</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>cout </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">98</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">]</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> endl</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//compiles wi=
thout error</span></div></code></div><br><br></li><li>Avoid reserving memor=
y for struct members which reference compiler known variables locations.<br=
><br>Imagine a class with a member array of some complex structure, as each=
 of it's elements have some pre-defined meaning and we want to direct acces=
s some of it's element structure member. For the purpose we decide to creat=
e a reference to the desired location:<br><br><br></li><div class=3D"pretty=
print" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word=
; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div c=
lass=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> B</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> S </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> &nbsp; &nbsp;<br><br>&nbsp; &nbsp; =
B arr</span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</sp=
an><span style=3D"color: #066;" class=3D"styled-by-prettify">5</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">];</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> &nbsp;<br>&nbsp; &nbsp; &nbsp;=
 <br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">NumberOfSome=
thing</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">3</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">].</span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">FieldName</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">};</span></div></code></div><br>Each object created with the above=
 structure will allocate space to store the reference 'NumberOfSomething', =
no matter that the location of the referenced object can be calculated at c=
ompile-time ('arr[3].FieldName').<br><br>Life <a href=3D"http://melpon.org/=
wandbox/permlink/UviWmfFquWOLuoJB">example</a>.</ol><div>The solution of th=
e above problems is adding a new variable specifier - 'inline'. It will spe=
cify that the variable value is compiler-known and no run-time is allocated=
 for them. Such variables can be assigned only by other variables with the =
same specifier or literals. Operations on such variables will be executed a=
t compile-time.&nbsp;They can be declared 'const' which means that are un-e=
ditable after initialization. Only such (declared as 'const') can be declar=
ed in the global space. Functions parameter or return-value can also be dec=
lared as 'inline' in which case the function itself will became implicitly =
inline and each instance of it should be evaluated at compile-time. Inline =
variables can name a type if they are declared with 'class', in which case =
they can be used as a type in declarations.</div><div><br>As a solution for=
 the second problem I suggest inline references. They have the same rules a=
s normal inlines with the exception that can't be assigned literals but obj=
ect names.</div><div><br></div><div>So the first problem can be solved like=
:<br><br></div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(18=
7, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"=
><code class=3D"prettyprint"><div class=3D"prettyprint" style=3D"border: 1p=
x solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(25=
0, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Matrix</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> x_size</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> y_size</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">public</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; &nbsp; </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Matrix</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> width</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> height</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">):</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; x_size</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">width</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">},</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; y_size</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">height</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">if</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(!</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">x_size </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">||</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">!</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">y_size</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">throw</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
><br>&nbsp; &nbsp; </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Matrix</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">cons=
t</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> width</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> height</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//overload of 'Matrix' constructor for inline variables</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &n=
bsp; &nbsp; &nbsp; x_size</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">width</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>},</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp; &nbsp; &nbsp; y_size</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">height</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>&nbsp; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">if</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(!</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">x_size </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">||</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">!</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">y_size</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">//checking for parameters validity done at com=
pile-time</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">static_assert</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">false</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">"Invalid width &amp; height parameters."</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Matrix</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">delete</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></div></=
code></div></code></div><div><br></div><div><br></div><div>If we now instan=
ce 'Matrix' like this:<br><br><div class=3D"prettyprint" style=3D"border: 1=
px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(2=
50, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Matrix</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by=
-prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">);</span></div></code></div><span class=3D"styled-by-prettify" style=3D"f=
ont-family: monospace; line-height: 17px; color: rgb(102, 102, 0); backgrou=
nd-color: rgb(250, 250, 250);"><br></span>Our constructor overload with inl=
ine parameters will be executed, reporting compiler error.</div><div><br>An=
d the second problem can be solved like:<br><br><br><div class=3D"prettypri=
nt" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; b=
ackground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div clas=
s=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 B</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> S </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> &nbsp; &nbsp;<br><br>&nbsp; &nbsp; B=
 arr</span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</spa=
n><span style=3D"color: #066;" class=3D"styled-by-prettify">5</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">];</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> &nbsp;<br>&nbsp; &nbsp; &nbsp; =
<br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">&nbsp;</span>=
<span class=3D"styled-by-prettify"><font color=3D"#000088">inline&nbsp;</fo=
nt></span><span style=3D"color: #606;" class=3D"styled-by-prettify">NumberO=
fSomething</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D=
"color: #066;" class=3D"styled-by-prettify">3</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">].</span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">FieldName</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">};</span></div></code></div><span class=3D"styled-by-prettify" s=
tyle=3D"font-family: monospace; color: rgb(102, 102, 0); background-color: =
rgb(250, 250, 250);"><br></span>In which case in instances of 'B' inline re=
ference 'NumberOfSomething' will be created with object name 'arr[3].FieldN=
ame', without allocating memory for it. Accessing it will be equal to acces=
sing 'arr[3].FieldName'.</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_987_1606571808.1419026088941--
------=_Part_986_907668407.1419026088941--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 19 Dec 2014 16:50:17 -0800
Raw View
On Friday 19 December 2014 13:54:48 sasho648 wrote:
> And the second problem can be solved like:
>
>
> struct B;
>
> struct S {
>
>     B arr[5];
>
>     int & inline NumberOfSomething = arr[3].FieldName;
> };
>
> In which case in instances of 'B' inline reference 'NumberOfSomething' will
> be created with object name 'arr[3].FieldName', without allocating memory
> for it. Accessing it will be equal to accessing 'arr[3].FieldName'.

Did you mean for this variable to be "const inline"?

If it's not const, it stands to reason that the reference could be bound
elsewhere, for example in a copy constructor.

And besides, I don't think you can guarantee or require that it doesn't take
up space in the structure. Again the example of a copy constructor:

 S s1;
 assert(&s1.NumberOfSomething == &s1.arr[3].FieldName);

 S s2 = s1;
 assert(&s2.NumberOfSomething == &s1.arr[3].FieldName); // yes, s1

Since s2.NumberOfSomething was copied from s1.NumberOfSomething, it bound to
the same variable, which in turn means the compiler must keep space in the
struct for the reference since it can't know what it was bound to if the
object was constructed from a copy, not from the default constructor.

If you provide the copy and move constructors, then it still stands to reason
that NumberOfSomething can be bound to anything.

In short, I don't see how a member inline reference would be different from a
regular member reference.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Sat, 20 Dec 2014 06:43:56 -0800 (PST)
Raw View
------=_Part_56_361848433.1419086636219
Content-Type: multipart/alternative;
 boundary="----=_Part_57_2060408774.1419086636219"

------=_Part_57_2060408774.1419086636219
Content-Type: text/plain; charset=UTF-8

It wouldn't work in the case because as I mentioned above, inline
references will be bound either to another inline reference or to actual
object name (not a reference to one of those). So such copy-constructor
will be illegal (unless it's parameter is inline reference too):

struct S {
    S(const S &arg) : NumberOfSomething (arg.NumberOfSomething) //error
'arg.NumberOfSomething' doesn't name object (but instead is a reference to
such)
    { }

    B arr[5];

    int & inline NumberOfSomething = arr[3].FieldName;
};

However I don't see a reason why would you want to copy such a reference as
it's purpose is just to be another name of some data member. You could
write the copy-constructor only for the data:

struct S {
    S(const S &arg)
    { memcpy((void*)&arr, (void*)&arg.arr, sizeof(arr)); }

    B arr[5];

    int & inline NumberOfSomething = arr[3].FieldName;
};

Also class members inlines can be only 'const' (inline references doesn't
count as they're implicit constant).

Some examples of 'inline' references:

int *pa;

int a;

int & inline var_0 = (new S())->NumberOfSomething; //invalid '(new
S())->NumberOfSomething' doesn't name an object

int & inline var_1 = *pa; //same as above

int & inline var_2 = a; //ok 'a' names an object

var_2 = 9; //same as 'a = 9'

I wanted to add that constructors which initialize 'inline' members, if
their value can't be determined at the time of parsing the class which they
belong to, and methods which use them are implicit inline and should be
executed at compiler time. In such cases the class type is incomplete. In
the above example this is not true because the value of 'NumberOfSomething'
can be determined at class parsing time.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_57_2060408774.1419086636219
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It wouldn't work in the case because as I mentioned above,=
 inline references will be bound either to another inline reference or to a=
ctual object name (not a reference to one of those). So such copy-construct=
or will be illegal (unless it's parameter is inline reference too):<br><br>=
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); w=
ord-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> S </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> <br>&nbsp; &nbsp; S</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">const</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> S </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&am=
p;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">arg</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">NumberOfSomething</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">arg</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">.</span><span style=3D"color: #606;" class=3D"styled-by-prettify">N=
umberOfSomething</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #800;" class=3D"styled-by-prettify">//error 'arg=
..NumberOfSomething' doesn't name object (but instead is a reference to such=
)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp=
; &nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; B arr<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">5</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">];</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> &nbsp;<br>&nbsp; &nbsp; &nbsp; <br>=
&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">NumberOfSomething</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> arr</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">[</span><span style=3D"color: #066;" class=3D"styl=
ed-by-prettify">3</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">].</span><span style=3D"color: #606;" class=3D"styled-by-prettify">F=
ieldName</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></div></=
code></div><div><span style=3D"font-family: monospace; color: rgb(102, 102,=
 0); background-color: rgb(250, 250, 250);"><br></span></div><div>However I=
 don't see a reason why would you want to copy such a reference as it's pur=
pose is just to be another name of some data&nbsp;member. You could write t=
he copy-constructor only for the data:<br><br><div class=3D"prettyprint" st=
yle=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgro=
und-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"s=
ubprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">st=
ruct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> S </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> <br>&nbsp; &nbsp; S</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> S </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">arg</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> memcpy</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">((</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">void</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">*)&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
arr</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">*)&amp;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">arg</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">arr</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">sizeof</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">arr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">));</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; B arr</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color: #066=
;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">];</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> &nbsp;<br>&nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">NumberOfSomething</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> arr</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">[</span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">].</span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">FieldName</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">};</span></div></code></div><span class=
=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102, 10=
2, 0); background-color: rgb(250, 250, 250);"><span style=3D"color: rgb(34,=
 34, 34); font-family: Arial, Helvetica, sans-serif; background-color: whit=
e;"><div><span class=3D"styled-by-prettify" style=3D"font-family: monospace=
; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"><span sty=
le=3D"color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; ba=
ckground-color: white;"><br></span></span></div><div><span class=3D"styled-=
by-prettify" style=3D"font-family: monospace; color: rgb(102, 102, 0); back=
ground-color: rgb(250, 250, 250);"><span style=3D"color: rgb(34, 34, 34); f=
ont-family: Arial, Helvetica, sans-serif; background-color: white;">Also cl=
ass members inlines can be only 'const' (inline references doesn't count as=
 they're implicit constant).</span></span></div><div><br></div><div>Some ex=
amples of 'inline' references:</div></span></span></div><div><br></div><div=
 class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-=
wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">p=
a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> va=
r_0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">new</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> S</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">())-&gt;</span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">NumberOfSomething</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">//invalid '(new S())-&gt;NumberOfSomething' doesn't name an=
 object</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> var_1 </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">pa</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #800;" class=3D"styled-by-prettify">//same as above</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> var_2 </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> a</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//ok 'a' =
names an object</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br><br>var_2 </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">9</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">//same as 'a =3D 9'</span></div></=
code></div><font color=3D"#666600"><br></font>I wanted to add that construc=
tors which initialize 'inline' members, if their value can't be determined =
at the time of parsing the class which they belong to,&nbsp;and methods whi=
ch use them are implicit inline and should be executed at compiler time. In=
 such cases the class type is incomplete. In the above example this is not =
true because the value of 'NumberOfSomething' can be determined at class pa=
rsing time.</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_57_2060408774.1419086636219--
------=_Part_56_361848433.1419086636219--

.


Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Sat, 20 Dec 2014 06:54:09 -0800 (PST)
Raw View
------=_Part_1702_276889080.1419087249562
Content-Type: multipart/alternative;
 boundary="----=_Part_1703_77704511.1419087249562"

------=_Part_1703_77704511.1419087249562
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

=20

As I understand your suggestion, it comprises (please correct me if I have=
=20
misunderstood anything):


=20
   1.=20
  =20
   use the =E2=80=98inline=E2=80=99 keyword as part of the formal parameter=
s of a function=20
   to specify that only constant expressions can be used,
   2.=20
  =20
   allow types for function parameters, and
   3.=20
  =20
   allow members that can reference other members without the need for=20
   extra storage, so as to permit different access for reading and writing =
the=20
   referenced member.
  =20

 *Inlined formal parameters*=20

Should ISOCpp go down that road, wouldn=E2=80=99t it be more expressive to =
use=20
=E2=80=98constexpr=E2=80=99 instead of =E2=80=98inline=E2=80=99, as that mo=
re accurately captures the=20
intent.

It seems the *only reason* you want this syntax is for better compile-time=
=20
checking. Whereas that is a worthy cause in itself, are you sure you=E2=80=
=99ve got=20
the best solution?

As Thiago said:

I think the code above might be better written instead as:=20


template<typename T, size_t sz>=20

T &std::array<T,sz>::operator[](size_type pos)=20
{=20
        if (std::is_constexpr(pos))=20
                static_assert(pos < sz, "invalid index");=20

        // call internal, private function=20
        return this->_Internal_get(pos);=20
}=20

Where std::is_consteexpr [*sic*] is similar to the GCC builtin=20
__builtin_constant_p,=20
but ensures that the static_assert won't be tried if the condition failed.=
=20

 This would be a library solution (albeit necessitating core support), so=
=20
is more likely to be accepted. I, personally, would far prefer a predicate=
=20
along the lines of std::is_constexpr. I notice you haven=E2=80=99t explaine=
d what=20
was wrong with this.


*Allowing types for function parameters*=20

Is the only reason for this your dislike of the current template syntax? I=
=20
see from another thread that you find templates difficult. What do you find=
=20
difficult with them?

I made the comment,

Firstly, whether or not you want this as a template replacement, I object=
=20
to having to specify the type when the compiler can deduce that from the=20
variables.=20

This was about type deduction, which can (easily) be done using the current=
=20
template syntax, but you responded with examples where the compiler doesn=
=E2=80=99t=20
do type deduction. Was I unclear in what I said?

You have come up with a novel syntax for expressing what is essentially a=
=20
template specification:
auto FuncAdd(inline typename T =3D=3D int, T a, T b) -> T=20



This is just confusing. You readily admitted that =E2=80=9CYou're absolutel=
y right=20
- we could create the 'int' overload of the function just like you said =E2=
=80=A6=E2=80=9D=20
regarding my comment omitting the =E2=80=98inline typename T =3D=3D=E2=80=
=98 from the formal=20
parameter list, but haven=E2=80=99t explained why your solution is better (=
or even=20
comparable).

As I said earlier (but without expanding on my reasons=E2=80=94sorry, but I=
 was=20
limited to a 120 character text):

It seems there is some confusion: a function template is a SET of=20
functions, so should have a different syntax.=20

p.s. I was not referring to template specialisations, but the fact that=20
each separate type would necessitate a new function to be generated by the=
=20
compiler.

Being a set, or family, of functions, we cannot take the address of it:
int foo(inline typename T, T v);

auto my_func =3D &foo; // illegal=E2=80=A6 cannnot point to more than one f=
unction at=20
a time=20


However, I might need to take the address of one of the functions of the=20
set, which seems impossible with this syntax. Using templates, we would=20
write:
template <typename T> int foo1(T v);

auto my_func =3D &foo; // fine=E2=80=A6 decltype(my_func) is int (*)(T)=20

*Class members referencing other members*=20

As Thiago has stated, this will still need space within an object.
*Other comments*=20

It seems that you are right, and everyone else is wrong, which, unless your=
=20
name is =E2=80=98God=E2=80=99, is the height of arrogance.

I can see that English is not you first language, but we still need to see=
=20
better answers to our comments.

Please, please, please, *don=E2=80=99t* use foul language when we disagree =
with=20
you. It is totally unprofessional and counter-productive.

Please don=E2=80=99t take these comments, or any other comments we have mad=
e on=20
this thread wrongly. We do appreciate suggestions, just so long as you at=
=20
least listen to what we are saying, and don=E2=80=99t assume you know bette=
r than=20
any of us. We want to help.

You make it sound like ISOCpp are not concerned about proposals breaking=20
existing code. You suggest that the introduction of a new keyword breaks=20
code. While, in theory, new keywords do have the potential of breaking=20
existing code, any new keywords (at least since C++98) are chosen=20
carefully, so that the likelihood of that happening is remote.

constexpr is *not* useless, as you allege=E2=80=94it allows compile-time co=
nstants=20
to invoke functions (along with other things). Prior to its introduction in=
=20
C++11, for example, functions couldn=E2=80=99t be used in TMP (but =E2=80=
=98everyone=20
doesn't care about meta-programming=E2=80=99).



--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_1703_77704511.1419087249562
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">
<p style=3D"margin-bottom: 0cm">As I understand your suggestion, it
comprises (please correct me if I have misunderstood anything):</p>
<p style=3D"margin-bottom: 0cm"><br>
</p>
<ol><li><p style=3D"margin-bottom: 0cm">use the =E2=80=98inline=E2=80=99 ke=
yword as
 part of the formal parameters of a function to specify that only
 constant expressions can be used,</p>
 </li><li><p style=3D"margin-bottom: 0cm">allow types for function
 parameters, and</p>
 </li><li><p style=3D"margin-bottom: 0cm">allow members that can reference
 other members without the need for extra storage, so as to permit
 different access for reading and writing the referenced member.</p>
</li></ol>
<p style=3D"margin-bottom: 0cm"><br>
</p>
<h1 class=3D"western"><font size=3D"4"><b>Inlined formal parameters</b></fo=
nt></h1>
<p>Should ISOCpp go down that road, wouldn=E2=80=99t it be more expressive
to use =E2=80=98constexpr=E2=80=99 instead of =E2=80=98inline=E2=80=99, as =
that more
accurately captures the intent.</p>
<p>It seems the <i>only reason</i><span style=3D"font-style: normal">
you want this syntax is for better compile-time checking.  Whereas
that is a worthy cause in itself, are you sure you=E2=80=99ve got the best
solution?</span></p>
<p>As Thiago said:</p>
<p style=3D"margin-left: 1.25cm; margin-bottom: 0cm">I think the code
above might be better written instead as:=20
</p>
<p style=3D"margin-left: 1.25cm; margin-bottom: 0cm"><br>template&lt;typena=
me
T, size_t sz&gt;=20
</p>
<p style=3D"margin-left: 1.25cm; margin-bottom: 0cm">T
&amp;std::array&lt;T,sz&gt;::operator[](size_type pos) <br>{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
(std::is_constexpr(pos)) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static_assert(pos
&lt; sz, "invalid index"); <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;//
call internal, private function <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;return
this-&gt;_Internal_get(pos); <br>} <br><br>Where std::is_consteexpr
[<i>sic</i><span style=3D"font-style: normal">]</span> is similar to
the GCC builtin __builtin_constant_p, <br>but ensures that the
static_assert won't be tried if the condition failed. <br><br>
</p>
<p style=3D"margin-bottom: 0cm">This would be a library solution
(albeit necessitating core support), so is more likely to be
accepted.  I, personally, would far prefer a predicate along the
lines of std::is_constexpr.  I notice you haven=E2=80=99t explained what
was wrong with this.</p><p style=3D"margin-bottom: 0cm"><br></p>
<h1 class=3D"western"><b><font size=3D"4">Allowing types for function param=
eters</font></b></h1><b><font size=3D"4">
</font></b><p>Is the only reason for this your dislike of the current templ=
ate
syntax?  I see from another thread that you find templates difficult.
 What do you find difficult with them?</p>
<p>I made the comment,</p>
<p style=3D"margin-left: 1.25cm">Firstly, whether or not you want this
as a template replacement, I object to having to specify the type
when the compiler can deduce that from the variables.=20
</p>
<p>This was about type deduction, which can (easily) be done using
the current template syntax, but you responded with examples where
the compiler doesn=E2=80=99t do type deduction.  Was I unclear in what I
said?</p>
<p>You have come up with a novel syntax for expressing what is
essentially a template specification:</p>
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">FuncAdd</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T a</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> T b</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> T <br><br><br></span></div></code></div><p><br>This is =
just confusing.  You readily admitted that =E2=80=9CYou're
absolutely right - we could create the 'int' overload of the function
just like you said =E2=80=A6=E2=80=9D regarding my comment omitting the =E2=
=80=98inline
typename T =3D=3D=E2=80=98 from the formal parameter list, but haven=E2=80=
=99t
explained why your solution is better (or even comparable).</p>
<p>As I said earlier (but without expanding on my reasons=E2=80=94sorry,
but I was limited to a 120 character text):</p>
<p style=3D"margin-left: 1.25cm">It seems there is some confusion: a
function template is a SET of <br>functions, so should have a
different syntax.=20
</p>
<p>p.s. I was not referring to template specialisations, but the fact
that each separate type would necessitate a new function to be
generated by the compiler.</p>
<p>Being a set, or family, of functions, we cannot take the address
of it:</p>
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> foo</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> T v</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> my_func </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">foo</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">// illegal=E2=80=A6 cannnot point to more than one functio=
n at a time </span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br><br></span></div></code></div><p><br>However, I might need to take th=
e address of one of the functions
of the set, which seems impossible with this syntax.  Using
templates, we would write:</p>
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> foo1</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">T v</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> my_func </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">foo</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">// fine=E2=80=A6 decltype(my_func) is int (*)(T) </span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v><h1 class=3D"western"><font size=3D"4"><b><br>Class members referencing o=
ther members</b></font></h1><font size=3D"4"><b>
</b></font><p>As Thiago has stated, this will still need space within an ob=
ject.</p>
<h1 class=3D"western"><b><font size=3D"4">Other comments</font></b></h1><b>=
<font size=3D"4">
</font></b><p>It seems that you are right, and everyone else is wrong, whic=
h,
unless your name is =E2=80=98God=E2=80=99, is the height of arrogance.</p>
<p>I can see that English is not you first language, but we still
need to see better answers to our comments.</p>
<p>Please, please, please, <i>don=E2=80=99t</i><span style=3D"font-style: n=
ormal">
use foul language when we disagree with you.  It is totally
unprofessional and counter-productive.</span></p>
<p><span style=3D"font-style: normal">Please don=E2=80=99t take these
comments, or any other comments we have made on this thread wrongly.=20
We do appreciate suggestions, just so long as you at least listen to
what we are saying, and don=E2=80=99t assume you know better than any of
us.  We want to help.</span></p>
<p><span style=3D"font-style: normal">You make it sound like ISOCpp are
not concerned about proposals breaking existing code.  You suggest
that the introduction of a new keyword breaks code.  While, in
theory, new keywords do have the potential of breaking existing code,
any new keywords (at least since C++98) are chosen carefully, so that
the likelihood of that happening is remote.</span></p>
<p><span style=3D"font-style: normal">constexpr is </span><i>not</i><span s=
tyle=3D"font-style: normal">
useless, as you allege=E2=80=94it allows compile-time constants to invoke
functions (along with other things).  Prior to its introduction in
C++11, for example, functions couldn=E2=80=99t be used in TMP (but
=E2=80=98everyone doesn't care about meta-programming=E2=80=99).</span></p>
<p><br><br>
</p>
</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1703_77704511.1419087249562--
------=_Part_1702_276889080.1419087249562--

.


Author: sasho648 <sasho648@mail.bg>
Date: Sat, 20 Dec 2014 11:44:39 -0800 (PST)
Raw View
------=_Part_1544_597788251.1419104679119
Content-Type: multipart/alternative;
 boundary="----=_Part_1545_1098633891.1419104679119"

------=_Part_1545_1098633891.1419104679119
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



20 =D0=B4=D0=B5=D0=BA=D0=B5=D0=BC=D0=B2=D1=80=D0=B8 2014, =D1=81=D1=8A=D0=
=B1=D0=BE=D1=82=D0=B0, 16:54:09 UTC+2, Douglas Boffey =D0=BD=D0=B0=D0=BF=D0=
=B8=D1=81=D0=B0:
>
> As I understand your suggestion, it comprises (please correct me if I hav=
e=20
> misunderstood anything):
>
>
> =20
>    1.=20
>   =20
>    use the =E2=80=98inline=E2=80=99 keyword as part of the formal paramet=
ers of a=20
>    function to specify that only constant expressions can be used,
>    2.=20
>   =20
>    allow types for function parameters, and
>    3.=20
>   =20
>    allow members that can reference other members without the need for=20
>    extra storage, so as to permit different access for reading and writin=
g the=20
>    referenced member.
>   =20
>
>  *Inlined formal parameters*=20
>
> Should ISOCpp go down that road, wouldn=E2=80=99t it be more expressive t=
o use=20
> =E2=80=98constexpr=E2=80=99 instead of =E2=80=98inline=E2=80=99, as that =
more accurately captures the=20
> intent.
>
> It seems the *only reason* you want this syntax is for better=20
> compile-time checking. Whereas that is a worthy cause in itself, are you=
=20
> sure you=E2=80=99ve got the best solution?
>
> As Thiago said:
>
> I think the code above might be better written instead as:=20
>
>
> template<typename T, size_t sz>=20
>
> T &std::array<T,sz>::operator[](size_type pos)=20
> {=20
>         if (std::is_constexpr(pos))=20
>                 static_assert(pos < sz, "invalid index");=20
>
>         // call internal, private function=20
>         return this->_Internal_get(pos);=20
> }=20
>
> Where std::is_consteexpr [*sic*] is similar to the GCC builtin=20
> __builtin_constant_p,=20
> but ensures that the static_assert won't be tried if the condition failed=
..=20
>
>  This would be a library solution (albeit necessitating core support), so=
=20
> is more likely to be accepted. I, personally, would far prefer a predicat=
e=20
> along the lines of std::is_constexpr. I notice you haven=E2=80=99t explai=
ned what=20
> was wrong with this.
>
>
> *Allowing types for function parameters*=20
>
> Is the only reason for this your dislike of the current template syntax? =
I=20
> see from another thread that you find templates difficult. What do you fi=
nd=20
> difficult with them?
>
> I made the comment,
>
> Firstly, whether or not you want this as a template replacement, I object=
=20
> to having to specify the type when the compiler can deduce that from the=
=20
> variables.=20
>
> This was about type deduction, which can (easily) be done using the=20
> current template syntax, but you responded with examples where the compil=
er=20
> doesn=E2=80=99t do type deduction. Was I unclear in what I said?
>
> You have come up with a novel syntax for expressing what is essentially a=
=20
> template specification:
> auto FuncAdd(inline typename T =3D=3D int, T a, T b) -> T=20
>
>
>
> This is just confusing. You readily admitted that =E2=80=9CYou're absolut=
ely right=20
> - we could create the 'int' overload of the function just like you said =
=E2=80=A6=E2=80=9D=20
> regarding my comment omitting the =E2=80=98inline typename T =3D=3D=E2=80=
=98 from the formal=20
> parameter list, but haven=E2=80=99t explained why your solution is better=
 (or even=20
> comparable).
>
> As I said earlier (but without expanding on my reasons=E2=80=94sorry, but=
 I was=20
> limited to a 120 character text):
>
> It seems there is some confusion: a function template is a SET of=20
> functions, so should have a different syntax.=20
>
> p.s. I was not referring to template specialisations, but the fact that=
=20
> each separate type would necessitate a new function to be generated by th=
e=20
> compiler.
>
> Being a set, or family, of functions, we cannot take the address of it:
> int foo(inline typename T, T v);
>
> auto my_func =3D &foo; // illegal=E2=80=A6 cannnot point to more than one=
 function=20
> at a time=20
>
>
> However, I might need to take the address of one of the functions of the=
=20
> set, which seems impossible with this syntax. Using templates, we would=
=20
> write:
> template <typename T> int foo1(T v);
>
> auto my_func =3D &foo; // fine=E2=80=A6 decltype(my_func) is int (*)(T)=
=20
>
> *Class members referencing other members*=20
>
> As Thiago has stated, this will still need space within an object.
> *Other comments*=20
>
> It seems that you are right, and everyone else is wrong, which, unless=20
> your name is =E2=80=98God=E2=80=99, is the height of arrogance.
>
> I can see that English is not you first language, but we still need to se=
e=20
> better answers to our comments.
>
> Please, please, please, *don=E2=80=99t* use foul language when we disagre=
e with=20
> you. It is totally unprofessional and counter-productive.
>
> Please don=E2=80=99t take these comments, or any other comments we have m=
ade on=20
> this thread wrongly. We do appreciate suggestions, just so long as you at=
=20
> least listen to what we are saying, and don=E2=80=99t assume you know bet=
ter than=20
> any of us. We want to help.
>
> You make it sound like ISOCpp are not concerned about proposals breaking=
=20
> existing code. You suggest that the introduction of a new keyword breaks=
=20
> code. While, in theory, new keywords do have the potential of breaking=20
> existing code, any new keywords (at least since C++98) are chosen=20
> carefully, so that the likelihood of that happening is remote.
>
> constexpr is *not* useless, as you allege=E2=80=94it allows compile-time=
=20
> constants to invoke functions (along with other things). Prior to its=20
> introduction in C++11, for example, functions couldn=E2=80=99t be used in=
 TMP (but=20
> =E2=80=98everyone doesn't care about meta-programming=E2=80=99).
>
>
>
> *@Inlined formal parameters*


The library solution proposed is invalid because we must somehow specify in=
=20
the declaration that the function is going to be executed at compile-time=
=20
(otherwise instances to it can be replaced with just assembly calls or the=
=20
function code itself). By using inline specifier we can do this, as I=20
mentioned above, by specifiying either the return-value or parameters of=20
function inline. Consider this:

void DoSomething(int a);

int main()
{
   DoSomething(9); //here we don't know is 'DoSomething' going to be=20
executed now or just being instanced for run-time execution
}

void DoSomething(int a)
{
   if (std::is_constexpr(a))=20
       static_assert(a < sz, "invalid index");
}

We could enable this library call only in 'constexpr' functions to avoid it=
..

But the real problem is different - why not allow proper compiler-constant=
=20
distinction. What's the problem? Why we need to introduce 'constexpr'=20
functions which may take compiler-known values but may not and then add=20
explicit checks for that. Isn't this stupid and non-sense? Tell me please -=
=20
I am not being offensive now but just - this is at-least not well-thought:

If his idea is approved here is what happens:

constexpr void Func(int a)
{
   if (std::is_constexpr(a))
   {
      //Then work with 'a' as if it a constant expression

   }
   else
   {
      //Else work as if 'a' is not a constant expression

   }
}

Imagine we have a multiple parameters now and the mess becomes full:

constexpr void Func(int a, int b, int c)
{
   if (std::is_constexpr(a) && std::is_constexpr(b) && !std::is_constexpr(c
))
   {
      //Then work as if 'a' and 'b' are constant expressions and 'c' is not

   }
   else if(std::is_constexpr(a) && !std::is_constexpr(b) && std::
is_constexpr(c))
   {
      //Else work as if 'a' and 'c' are constant expressions and 'b' is not

   }
   else if(!std::is_constexpr(a) && std::is_constexpr(b) && std::
is_constexpr(c))
   {
      //Else work as if 'b' and 'c' are constant expressions and 'a' is not

   }


//....
}


*@Allowing types for function parameters*

This was about type deduction, which can (easily) be done using the current=
=20
> template syntax, but you responded with examples where the compiler doesn=
=E2=80=99t=20
> do type deduction. Was I unclear in what I said?


Sorry but I believe in the case you just have skipped this=20
line, unknowingly of-course:=20

"Automated 'type' deduction is being better implemented by using 'auto'=20
> keyword as function parameter or return-value. Like this:
>
> auto FuncAdd(auto a, auto b) //also general function, which have=20
> parameters and return-value of any type=20
> {
>     return a + b;
> }
> "


 ____________________________________

You have come up with a novel syntax for expressing what is essentially a=
=20
> template specification:
> auto FuncAdd(inline typename T =3D=3D int, T a, T b) -> T=20
>
>
> This is just confusing. You readily admitted that =E2=80=9CYou're absolut=
ely right=20
> - we could create the 'int' overload of the function just like you said =
=E2=80=A6=E2=80=9D=20
> regarding my comment omitting the =E2=80=98inline typename T =3D=3D=E2=80=
=98 from the formal=20
> parameter list, but haven=E2=80=99t explained why your solution is better=
 (or even=20
> comparable).


 I admitted that and never said my solution is better. It was just an=20
example, showing that similar functionality as templates can be achieved=20
with my syntax. Quote again:

You're absolutely right - we could create the 'int' overload of the=20
> function just like you said but using templates is the same - you aren't=
=20
> required to specialize them but instead create non-template function with=
=20
> the needed type. I just wanted to show that the same behavior as=20
> 'template''s specializing is possible (but *not required*).


But now after you reminding about general function type with concrete=20
inline variable values - it seemed that this syntax should be still=20
required. However writing specialized functions won't be a good idea anyway=
..

Being a set, or family, of functions, we cannot take the address of it:
> int foo(inline typename T, T v);
> auto my_func =3D &foo; // illegal=E2=80=A6 cannnot point to more than one=
 function=20
> at a time=20
>
> However, I might need to take the address of one of the functions of the=
=20
> set, which seems impossible with this syntax. Using templates, we would=
=20
> write:
> template <typename T> int foo1(T v);
> auto my_func =3D &foo; // fine=E2=80=A6 decltype(my_func) is int (*)(T)=
=20


I believe in the second example you meant something like:

template <typename T> int foo1(T v);
auto my_func =3D &foo1<T>; // fine=E2=80=A6 decltype(my_func) is int (*)(T)

Because your example won't compile in the way you have written it. Anyway -=
=20
yes we could do the same by taking an address of the function with=20
specialized inline parameters or if a class, inline members. Example:

int foo1(inline class T, T v);

auto my_func =3D &(foo1(inline class =3D=3D double, T) -> int); // fine..=
=20
decltype(my_func) is int (*)(inline class =3D=3D double, T)

Here 'foo1(inline class =3D=3D double, T) -> int' can be thought as complet=
e=20
function, just like, in your example, ' foo1<T>', with type 'int (*)(inline=
=20
class =3D=3D double, T)'. The syntax of this constructions is the following=
:

*function-declaration -> return-type*

As parameters which specialize the function will be selected with '=3D=3D'.

Such functions will be instanced without  re-specifiying the specialized=20
parameters. So 'my_func' will be instanced by only specifying 'v':

(*my_func)(9); //'v' argument =3D 9

For classes - the type of specialized object could be retrieved by getting=
=20
the type of temporary object or using member specialization, similar way as=
=20
above:

struct S
{
    S(const inline class arg) : T(arg) { }

    const inline class T;
};

The type of a specialized struct is written using the following syntax:

*class-name **{ **class-members **}*

As specializing class-members will be done via '=3D=3D'. So the 'S' type wi=
th=20
'T' equal 'int' is:

S { T =3D=3D int; }


Some examples

decltype(S(int)) S a{}; //will instance S::S(const inline =3D=3D int), type=
=20
received from constructing temporary

S b(int); //same as above with type of 'S { T =3D=3D int; }'

S { T =3D=3D int; } c{}; //same as above


In this context I must admit that expressing it is harder than templates,=
=20
so maybe they should be still a good choice for certain goals. However for=
=20
others my construction will be prefered.

*@Class members referencing other members*

I wrote about this in my previous post.

*@Other comments*

Yep - sorry my English is very bad. I believe nobody care about=20
meta-programming. When I suggested the ability to create enums by string=20
someone said that he don't need this and can use script language to=20
generate such things. Also some people think that not alerting user for=20
compiler-time errors is something normal.

I'm not god but as I pointed out above some things are not-very sense.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_1545_1098633891.1419104679119
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>20 =D0=B4=D0=B5=D0=BA=D0=B5=D0=BC=D0=B2=D1=80=D0=
=B8 2014, =D1=81=D1=8A=D0=B1=D0=BE=D1=82=D0=B0, 16:54:09 UTC+2, Douglas Bof=
fey =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0:<blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr">
<p style=3D"margin-bottom:0cm">As I understand your suggestion, it
comprises (please correct me if I have misunderstood anything):</p>
<p style=3D"margin-bottom:0cm"><br>
</p>
<ol><li><p style=3D"margin-bottom:0cm">use the =E2=80=98inline=E2=80=99 key=
word as
 part of the formal parameters of a function to specify that only
 constant expressions can be used,</p>
 </li><li><p style=3D"margin-bottom:0cm">allow types for function
 parameters, and</p>
 </li><li><p style=3D"margin-bottom:0cm">allow members that can reference
 other members without the need for extra storage, so as to permit
 different access for reading and writing the referenced member.</p>
</li></ol>
<p style=3D"margin-bottom:0cm"><br>
</p>
<h1><font size=3D"4"><b>Inlined formal parameters</b></font></h1>
<p>Should ISOCpp go down that road, wouldn=E2=80=99t it be more expressive
to use =E2=80=98constexpr=E2=80=99 instead of =E2=80=98inline=E2=80=99, as =
that more
accurately captures the intent.</p>
<p>It seems the <i>only reason</i><span style=3D"font-style:normal">
you want this syntax is for better compile-time checking.  Whereas
that is a worthy cause in itself, are you sure you=E2=80=99ve got the best
solution?</span></p>
<p>As Thiago said:</p>
<p style=3D"margin-left:1.25cm;margin-bottom:0cm">I think the code
above might be better written instead as:=20
</p>
<p style=3D"margin-left:1.25cm;margin-bottom:0cm"><br>template&lt;typename
T, size_t sz&gt;=20
</p>
<p style=3D"margin-left:1.25cm;margin-bottom:0cm">T
&amp;std::array&lt;T,sz&gt;::operator[](<wbr>size_type pos) <br>{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
(std::is_constexpr(pos)) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static_assert(<wbr>pos
&lt; sz, "invalid index"); <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;//
call internal, private function <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;return
this-&gt;_Internal_get(pos); <br>} <br><br>Where std::is_consteexpr
[<i>sic</i><span style=3D"font-style:normal">]</span> is similar to
the GCC builtin __builtin_constant_p, <br>but ensures that the
static_assert won't be tried if the condition failed. <br><br>
</p>
<p style=3D"margin-bottom:0cm">This would be a library solution
(albeit necessitating core support), so is more likely to be
accepted.  I, personally, would far prefer a predicate along the
lines of std::is_constexpr.  I notice you haven=E2=80=99t explained what
was wrong with this.</p><p style=3D"margin-bottom:0cm"><br></p>
<h1><b><font size=3D"4">Allowing types for function parameters</font></b></=
h1><b><font size=3D"4">
</font></b><p>Is the only reason for this your dislike of the current templ=
ate
syntax?  I see from another thread that you find templates difficult.
 What do you find difficult with them?</p>
<p>I made the comment,</p>
<p style=3D"margin-left:1.25cm">Firstly, whether or not you want this
as a template replacement, I object to having to specify the type
when the compiler can deduce that from the variables.=20
</p>
<p>This was about type deduction, which can (easily) be done using
the current template syntax, but you responded with examples where
the compiler doesn=E2=80=99t do type deduction.  Was I unclear in what I
said?</p>
<p>You have come up with a novel syntax for expressing what is
essentially a template specification:</p>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">auto</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#606">FuncAdd</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#008">inline</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">typename</span><span style=3D"color:#000"> T </span>=
<span style=3D"color:#660">=3D=3D</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">int</span><span style=3D"color:#660">,</span><sp=
an style=3D"color:#000"> T a</span><span style=3D"color:#660">,</span><span=
 style=3D"color:#000"> T b</span><span style=3D"color:#660">)</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">-&gt;</span><span st=
yle=3D"color:#000"> T <br><br><br></span></div></code></div><p><br>This is =
just confusing.  You readily admitted that =E2=80=9CYou're
absolutely right - we could create the 'int' overload of the function
just like you said =E2=80=A6=E2=80=9D regarding my comment omitting the =E2=
=80=98inline
typename T =3D=3D=E2=80=98 from the formal parameter list, but haven=E2=80=
=99t
explained why your solution is better (or even comparable).</p>
<p>As I said earlier (but without expanding on my reasons=E2=80=94sorry,
but I was limited to a 120 character text):</p>
<p style=3D"margin-left:1.25cm">It seems there is some confusion: a
function template is a SET of <br>functions, so should have a
different syntax.=20
</p>
<p>p.s. I was not referring to template specialisations, but the fact
that each separate type would necessitate a new function to be
generated by the compiler.</p>
<p>Being a set, or family, of functions, we cannot take the address
of it:</p>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">int</span><span style=3D"color:#000"> foo</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#008">inline</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#008">typename</span><=
span style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span=
 style=3D"color:#000"> T v</span><span style=3D"color:#660">);</span><span =
style=3D"color:#000"><br><br></span><span style=3D"color:#008">auto</span><=
span style=3D"color:#000"> my_func </span><span style=3D"color:#660">=3D</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;</sp=
an><span style=3D"color:#000">foo</span><span style=3D"color:#660">;</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#800">// illegal=E2=
=80=A6 cannnot point to more than one function at a time </span><span style=
=3D"color:#000"><br><br></span></div></code></div><p><br>However, I might n=
eed to take the address of one of the functions
of the set, which seems impossible with this syntax.  Using
templates, we would write:</p>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">template</span><span style=3D"color:#000"> </span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</s=
pan><span style=3D"color:#000"> T</span><span style=3D"color:#660">&gt;</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">int</span>=
<span style=3D"color:#000"> foo1</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">T v</span><span style=3D"color:#660">);</span><sp=
an style=3D"color:#000"><br><br></span><span style=3D"color:#008">auto</spa=
n><span style=3D"color:#000"> my_func </span><span style=3D"color:#660">=3D=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;<=
/span><span style=3D"color:#000">foo</span><span style=3D"color:#660">;</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#800">// fine=E2=
=80=A6 decltype(my_func) is int (*)(T) </span><span style=3D"color:#000"><b=
r></span></div></code></div><h1><font size=3D"4"><b><br>Class members refer=
encing other members</b></font></h1><font size=3D"4"><b>
</b></font><p>As Thiago has stated, this will still need space within an ob=
ject.</p>
<h1><b><font size=3D"4">Other comments</font></b></h1><b><font size=3D"4">
</font></b><p>It seems that you are right, and everyone else is wrong, whic=
h,
unless your name is =E2=80=98God=E2=80=99, is the height of arrogance.</p>
<p>I can see that English is not you first language, but we still
need to see better answers to our comments.</p>
<p>Please, please, please, <i>don=E2=80=99t</i><span style=3D"font-style:no=
rmal">
use foul language when we disagree with you.  It is totally
unprofessional and counter-productive.</span></p>
<p><span style=3D"font-style:normal">Please don=E2=80=99t take these
comments, or any other comments we have made on this thread wrongly.=20
We do appreciate suggestions, just so long as you at least listen to
what we are saying, and don=E2=80=99t assume you know better than any of
us.  We want to help.</span></p>
<p><span style=3D"font-style:normal">You make it sound like ISOCpp are
not concerned about proposals breaking existing code.  You suggest
that the introduction of a new keyword breaks code.  While, in
theory, new keywords do have the potential of breaking existing code,
any new keywords (at least since C++98) are chosen carefully, so that
the likelihood of that happening is remote.</span></p>
<p><span style=3D"font-style:normal">constexpr is </span><i>not</i><span st=
yle=3D"font-style:normal">
useless, as you allege=E2=80=94it allows compile-time constants to invoke
functions (along with other things).  Prior to its introduction in
C++11, for example, functions couldn=E2=80=99t be used in TMP (but
=E2=80=98everyone doesn't care about meta-programming=E2=80=99).</span></p>
<p><br><br></p></div></blockquote><div><h1><font size=3D"4"><b>@Inlined for=
mal parameters</b></font></h1></div><div><font size=3D"4"><b><br></b></font=
></div><div><font size=3D"4"><b><br></b></font></div><div>The library solut=
ion proposed is invalid because we must somehow specify in the declaration =
that the function is going to be executed at compile-time (otherwise instan=
ces to it can be replaced with just assembly calls or the function code its=
elf). By using inline specifier we can do this, as I mentioned above, by sp=
ecifiying either the return-value or parameters of function inline. Conside=
r this:<br><br></div><div class=3D"prettyprint" style=3D"border: 1px solid =
rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, =
250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">DoSomething</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> main</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp;</span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">DoSomething</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">9</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">//here we don't know is 'DoSomething' going to be executed n=
ow or just being instanced for run-time execution</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">DoSomething</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">if</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">is_constexpr</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><font color=3D"#000000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">a</span></font><span style=3D"color: #660;" class=
=3D"styled-by-prettify">))</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> <br>&nbsp; &nbsp; &nbsp; &nbsp;</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">static_assert</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">a </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> sz</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">"invali=
d index"</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></=
code></div><div><br></div><div>We could enable this library call only in 'c=
onstexpr' functions to avoid it.</div><div><br></div><div>But the real prob=
lem is different - why not allow proper compiler-constant distinction. What=
's the problem? Why we need to introduce 'constexpr' functions which may ta=
ke compiler-known values but may not and then add explicit checks for that.=
 Isn't this stupid and non-sense? Tell me please - I am not being offensive=
 now but just - this is at-least not well-thought:<br><br>If his idea is ap=
proved here is what happens:<br><br></div><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">const=
expr</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Func</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
if</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">is_constexpr</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">a</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">))</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>&nbsp; &nbsp;</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>&nbsp; &nbsp; &nbsp; </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//Then work with 'a' as if it a constant expression=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&n=
bsp; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; &nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">e=
lse</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp=
; &nbsp; &nbsp; </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">//Else work as if 'a' is not a constant expression</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp;</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><div>=
<br></div><div>Imagine we have a multiple parameters now and the mess becom=
es full:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(1=
87, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">Func</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> c</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp;</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">if</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">std</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">is_constexpr</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">a</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">is_constexpr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">b</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">!</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">is_constexpr</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">c</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">))</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>&nbsp; &nbsp;</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; </span><span style=3D"=
color: #800;" class=3D"styled-by-prettify">//Then work as if 'a' and 'b' ar=
e constant expressions and 'c' is not</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br><br>&nbsp; &nbsp;</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>&nbsp; &nbsp;</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">else</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">if</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_constexp=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">a</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">!</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_=
constexpr</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">b</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">is_constexpr</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">c</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">))</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>&nbsp; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>&nbsp; &nbsp; &nbsp; </span><span style=3D"color: #800;" class=3D"styled-=
by-prettify">//Else work as if 'a' and 'c' are constant expressions and 'b'=
 is not</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
><br>&nbsp; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>&nbsp; &nbsp;</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">else</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">if</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(!</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">is_constexpr</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">a</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">is_constexpr<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">b</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">is_constexpr</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">c</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
))</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp;=
 &nbsp; &nbsp; </span><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">//Else work as if 'b' and 'c' are constant expressions and 'a' is not<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nb=
sp; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><=
br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">//....<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></c=
ode></div><div><br></div></div><div><br></div><div><h1><b><font size=3D"4">=
@Allowing types for function parameters</font></b></h1></div><div><b><font =
size=3D"4"><br></font></b></div><blockquote class=3D"gmail_quote" style=3D"=
margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(2=
04, 204, 204); border-left-style: solid; padding-left: 1ex;">This was about=
 type deduction, which can (easily) be done using the current template synt=
ax, but you responded with examples where the compiler doesn=E2=80=99t do t=
ype deduction. Was I unclear in what I said?</blockquote><div><div><br></di=
v><div>Sorry but I believe in the case you just have skipped this line,&nbs=
p;unknowingly of-course:&nbsp;</div><div><br></div><blockquote style=3D"mar=
gin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204,=
 204, 204); border-left-style: solid; padding-left: 1ex;" class=3D"gmail_qu=
ote"></blockquote><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-le=
ft-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: so=
lid; padding-left: 1ex;" class=3D"gmail_quote">"Automated 'type' deduction =
is being better implemented by using 'auto' keyword as function parameter o=
r return-value. Like this:<br><br><code><span style=3D"color: rgb(0, 0, 136=
);">auto</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span styl=
e=3D"color: rgb(102, 0, 102);">FuncAdd</span><span style=3D"color: rgb(102,=
 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);">auto</span><span =
style=3D"color: rgb(0, 0, 0);">&nbsp;a</span><span style=3D"color: rgb(102,=
 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span =
style=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0,=
 0);">&nbsp;b</span><span style=3D"color: rgb(102, 102, 0);">)</span><span =
style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color: rgb(136, =
0, 0);">//also general function, which have parameters and return-value of =
any type&nbsp;<br></span></code><code><span style=3D"color: rgb(102, 102, 0=
);">{<br></span></code><code><span style=3D"color: rgb(0, 0, 0);">&nbsp; &n=
bsp;&nbsp;</span><span style=3D"color: rgb(0, 0, 136);">return</span><span =
style=3D"color: rgb(0, 0, 0);">&nbsp;a&nbsp;</span><span style=3D"color: rg=
b(102, 102, 0);">+</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;b</span=
><span style=3D"color: rgb(102, 102, 0);">;<br></span></code><code><span st=
yle=3D"color: rgb(102, 102, 0);">}<br></span></code><code><span style=3D"co=
lor: rgb(102, 102, 0);">"</span></code></blockquote><div><br></div><div>&nb=
sp;____________________________________</div></div><div><br></div><div><blo=
ckquote style=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-=
left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex=
;" class=3D"gmail_quote">You have come up with a novel syntax for expressin=
g what is essentially a template specification:<br><code><span style=3D"col=
or: rgb(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;=
</span><span style=3D"color: rgb(102, 0, 102);">FuncAdd</span><span style=
=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 136);=
">inline</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span styl=
e=3D"color: rgb(0, 0, 136);">typename</span><span style=3D"color: rgb(0, 0,=
 0);">&nbsp;T&nbsp;</span><span style=3D"color: rgb(102, 102, 0);">=3D=3D</=
span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color=
: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(102, 102, 0);">,</sp=
an><span style=3D"color: rgb(0, 0, 0);">&nbsp;T a</span><span style=3D"colo=
r: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;T =
b</span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"col=
or: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color: rgb(102, 102, 0);">-&=
gt;</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;T&nbsp;<br></span></co=
de><code><span style=3D"color: rgb(0, 0, 0);"><br></span></code><br>This is=
 just confusing. You readily admitted that =E2=80=9CYou're absolutely right=
 - we could create the 'int' overload of the function just like you said =
=E2=80=A6=E2=80=9D regarding my comment omitting the =E2=80=98inline typena=
me T =3D=3D=E2=80=98 from the formal parameter list, but haven=E2=80=99t ex=
plained why your solution is better (or even comparable).</blockquote><div>=
<br></div><div>&nbsp;I admitted that and never said my solution is better. =
It was just an example, showing that similar functionality as templates can=
 be achieved with my syntax. Quote again:<br><br><blockquote class=3D"gmail=
_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-=
left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex=
;">You're absolutely right - we could create the 'int' overload of the func=
tion just like you said but using templates is the same - you aren't requir=
ed to specialize them but instead create non-template function with the nee=
ded type. I just wanted to show that the same behavior as 'template''s spec=
ializing is possible (but <b>not required</b>).</blockquote><div><br></div>=
<div>But now after you reminding about general function type with concrete =
inline variable values - it seemed that this syntax should be still require=
d. However writing specialized functions won't be a good idea anyway.</div>=
</div></div><div><br></div><div><blockquote style=3D"margin: 0px 0px 0px 0.=
8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-=
left-style: solid; padding-left: 1ex;" class=3D"gmail_quote">Being a set, o=
r family, of functions, we cannot take the address of it:<br><code><span st=
yle=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0)=
;">&nbsp;foo</span><span style=3D"color: rgb(102, 102, 0);">(</span><span s=
tyle=3D"color: rgb(0, 0, 136);">inline</span><span style=3D"color: rgb(0, 0=
, 0);">&nbsp;</span><span style=3D"color: rgb(0, 0, 136);">typename</span><=
span style=3D"color: rgb(0, 0, 0);">&nbsp;T</span><span style=3D"color: rgb=
(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;T v</spa=
n><span style=3D"color: rgb(102, 102, 0);">);</span></code><code><span styl=
e=3D"color: rgb(0, 0, 0);"><br></span></code><code><span style=3D"color: rg=
b(0, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;my_fun=
c&nbsp;</span><span style=3D"color: rgb(102, 102, 0);">=3D</span><span styl=
e=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color: rgb(102, 102,=
 0);">&amp;</span><span style=3D"color: rgb(0, 0, 0);">foo</span><span styl=
e=3D"color: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"=
>&nbsp;</span><span style=3D"color: rgb(136, 0, 0);">// illegal=E2=80=A6 ca=
nnnot point to more than one function at a time&nbsp;</span></code><code><s=
pan style=3D"color: rgb(0, 0, 0);"><br></span></code><br>However, I might n=
eed to take the address of one of the functions of the set, which seems imp=
ossible with this syntax. Using templates, we would write:<br><code><span s=
tyle=3D"color: rgb(0, 0, 136);">template</span><span style=3D"color: rgb(0,=
 0, 0);">&nbsp;</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><=
span style=3D"color: rgb(0, 0, 136);">typename</span><span style=3D"color: =
rgb(0, 0, 0);">&nbsp;T</span><span style=3D"color: rgb(102, 102, 0);">&gt;<=
/span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"colo=
r: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;fo=
o1</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"co=
lor: rgb(0, 0, 0);">T v</span><span style=3D"color: rgb(102, 102, 0);">);</=
span></code><code><span style=3D"color: rgb(0, 0, 0);"><br></span></code><c=
ode><span style=3D"color: rgb(0, 0, 136);">auto</span><span style=3D"color:=
 rgb(0, 0, 0);">&nbsp;my_func&nbsp;</span><span style=3D"color: rgb(102, 10=
2, 0);">=3D</span><span style=3D"color: rgb(0, 0, 0);">&nbsp;</span><span s=
tyle=3D"color: rgb(102, 102, 0);">&amp;</span><span style=3D"color: rgb(0, =
0, 0);">foo</span><span style=3D"color: rgb(102, 102, 0);">;</span><span st=
yle=3D"color: rgb(0, 0, 0);">&nbsp;</span><span style=3D"color: rgb(136, 0,=
 0);">// fine=E2=80=A6 decltype(my_func) is int (*)(T)&nbsp;</span></code><=
/blockquote></div><div><code><span style=3D"color: rgb(136, 0, 0);"><br></s=
pan></code></div><div>I believe in the second example you meant something l=
ike:<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, =
187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">template</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> foo1<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">T v</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> my_func </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">foo1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// fine=E2=80=A6 decltype(my=
_func) is int (*)(T)</span></div></code></div><code><span style=3D"color: r=
gb(136, 0, 0);"><br></span></code>Because your example won't compile in the=
 way you have written it. Anyway - yes we could do the same by taking an ad=
dress of the function with specialized inline parameters or if a class, inl=
ine members. Example:<br><br></div><div class=3D"prettyprint" style=3D"bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: =
rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettypri=
nt"><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> foo1</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">inline</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> T v</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> my_func </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&amp;(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">foo1</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">double</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">-&gt;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">// fine.. decltyp=
e(my_func) is int (*)(inline class =3D=3D double, T)</span></div></code></d=
iv><div><br>Here '<span class=3D"styled-by-prettify" style=3D"font-family: =
monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">foo1=
</span><span class=3D"styled-by-prettify" style=3D"font-family: monospace; =
color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">(</span><sp=
an class=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb=
(0, 0, 136); background-color: rgb(250, 250, 250);">inline</span><span clas=
s=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, =
0); background-color: rgb(250, 250, 250);">&nbsp;</span><span class=3D"styl=
ed-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 136); bac=
kground-color: rgb(250, 250, 250);">class</span><span class=3D"styled-by-pr=
ettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); background-co=
lor: rgb(250, 250, 250);">&nbsp;</span><span class=3D"styled-by-prettify" s=
tyle=3D"font-family: monospace; color: rgb(102, 102, 0); background-color: =
rgb(250, 250, 250);">=3D=3D</span><span class=3D"styled-by-prettify" style=
=3D"font-family: monospace; color: rgb(0, 0, 0); background-color: rgb(250,=
 250, 250);">&nbsp;</span><span class=3D"styled-by-prettify" style=3D"font-=
family: monospace; color: rgb(0, 0, 136); background-color: rgb(250, 250, 2=
50);">double</span><span class=3D"styled-by-prettify" style=3D"font-family:=
 monospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"=
>,</span><span class=3D"styled-by-prettify" style=3D"font-family: monospace=
; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">&nbsp;T</span=
><span class=3D"styled-by-prettify" style=3D"font-family: monospace; color:=
 rgb(102, 102, 0); background-color: rgb(250, 250, 250);">)</span><span cla=
ss=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0,=
 0); background-color: rgb(250, 250, 250);">&nbsp;</span><span class=3D"sty=
led-by-prettify" style=3D"font-family: monospace; color: rgb(102, 102, 0); =
background-color: rgb(250, 250, 250);">-&gt;</span><span class=3D"styled-by=
-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); background=
-color: rgb(250, 250, 250);">&nbsp;</span><span class=3D"styled-by-prettify=
" style=3D"font-family: monospace; color: rgb(0, 0, 136); background-color:=
 rgb(250, 250, 250);">int</span>' can be thought as complete function, just=
 like, in your example, '&nbsp;<span class=3D"styled-by-prettify" style=3D"=
font-family: monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250=
, 250);">foo1</span><span class=3D"styled-by-prettify" style=3D"font-family=
: monospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);=
">&lt;</span><span class=3D"styled-by-prettify" style=3D"font-family: monos=
pace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">T</span><=
span class=3D"styled-by-prettify" style=3D"font-family: monospace; color: r=
gb(102, 102, 0); background-color: rgb(250, 250, 250);">&gt;</span>', with =
type 'int (*)<span class=3D"styled-by-prettify" style=3D"font-family: monos=
pace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">(</sp=
an><span class=3D"styled-by-prettify" style=3D"font-family: monospace; colo=
r: rgb(0, 0, 136); background-color: rgb(250, 250, 250);">inline</span><spa=
n class=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(=
0, 0, 0); background-color: rgb(250, 250, 250);">&nbsp;</span><span class=
=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 1=
36); background-color: rgb(250, 250, 250);">class</span><span class=3D"styl=
ed-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); backg=
round-color: rgb(250, 250, 250);">&nbsp;</span><span class=3D"styled-by-pre=
ttify" style=3D"font-family: monospace; color: rgb(102, 102, 0); background=
-color: rgb(250, 250, 250);">=3D=3D</span><span class=3D"styled-by-prettify=
" style=3D"font-family: monospace; color: rgb(0, 0, 0); background-color: r=
gb(250, 250, 250);">&nbsp;</span><span class=3D"styled-by-prettify" style=
=3D"font-family: monospace; color: rgb(0, 0, 136); background-color: rgb(25=
0, 250, 250);">double</span><span class=3D"styled-by-prettify" style=3D"fon=
t-family: monospace; color: rgb(102, 102, 0); background-color: rgb(250, 25=
0, 250);">,</span><span class=3D"styled-by-prettify" style=3D"font-family: =
monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">&nbs=
p;T</span><span class=3D"styled-by-prettify" style=3D"font-family: monospac=
e; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">)</span>=
'. The syntax of this constructions is the following:<br><br><i>function-de=
claration <b>-&gt; </b>return-type</i></div><div><i><br></i></div><div>As p=
arameters which specialize the function will be selected with '=3D=3D'.</di=
v><div><br></div><div>Such functions will be instanced without &nbsp;re-spe=
cifiying the specialized parameters. So '<span style=3D"color: rgb(0, 0, 0)=
; font-family: monospace; background-color: rgb(250, 250, 250);">my_func</s=
pan>' will be instanced by only specifying 'v':<br><br><span style=3D"color=
: rgb(0, 0, 0); font-family: monospace; background-color: rgb(250, 250, 250=
);"><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187=
); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(*</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">my_func</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)(</span><span style=3D"color: #066;" class=3D"styled-=
by-prettify">9</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//'v' argumen=
t =3D 9</span></div></code></div><br></span></div><div>For classes - the ty=
pe of specialized object could be retrieved by getting the type of temporar=
y object or using member specialization, similar way as above:<br><br></div=
><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); =
word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> S<br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp; S</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> arg</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">arg</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></d=
iv></code></div><div><br>The type of a specialized struct is written using =
the following syntax:<br><br><i>class-name </i><b>{ </b><i>class-members&nb=
sp;</i><b>}</b></div><div><b><br></b></div><div>As specializing class-membe=
rs will be done via '=3D=3D'. So the 'S' type with 'T' equal 'int' is:<br><=
br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187)=
; word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">S </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> T </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><=
br></div><div><br></div><div>Some examples<br><br></div><div><div class=3D"=
prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: brea=
k-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">decltype</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">S</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">))</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> S a</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//will instance S::S(const inline =3D=3D int), type=
 received from constructing temporary</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br><br>S b</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//sam=
e as above with type of 'S { T =3D=3D int; }'</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br><br>S </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> T </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> c</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//same as above</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span></div></code></div><br></div><div><=
br></div><div>In this context I must admit that expressing it is harder tha=
n templates, so maybe they should be still a good choice for certain goals.=
 However for others my construction will be prefered.<br><br></div><div><fo=
nt color=3D"#000000"></font></div><div><h1><font size=3D"4"><b>@Class membe=
rs referencing other members</b></font></h1></div><div><font size=3D"4"><b>=
<br></b></font></div><div>I wrote about this in my previous post.<br></div>=
<div><br></div><div><h1><b><font size=3D"4">@Other comments</font></b></h1>=
</div><div><b><font size=3D"4"><br></font></b></div><div>Yep - sorry my Eng=
lish is very bad. I believe nobody care about meta-programming. When I sugg=
ested the ability to create enums by string someone said that he don't need=
 this and can use script language to generate such things. Also some people=
 think that not alerting user for compiler-time errors is something normal.=
<br><b><font size=3D"4"><br></font></b>I'm not god but as I pointed out abo=
ve some things are not-very sense.<b><font size=3D"4"><br></font></b></div>=
</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1545_1098633891.1419104679119--
------=_Part_1544_597788251.1419104679119--

.


Author: sasho648 <sasho648@mail.bg>
Date: Sat, 20 Dec 2014 13:00:32 -0800 (PST)
Raw View
------=_Part_420_2053110754.1419109232291
Content-Type: multipart/alternative;
 boundary="----=_Part_421_865202482.1419109232291"

------=_Part_421_865202482.1419109232291
Content-Type: text/plain; charset=UTF-8

Edit. I wanted to allow functions overloading no-matter that they have
inline parameters or return-value that's way I insisted on adding the
return-type also when instancing a specialization of it. Recently however I
read that the return type can't be overloaded so specialized functions
could be written just like a function declaration. So the example of '
my_func' can be now written like:

int foo1(inline class T, T v);

auto my_func = &foo1(inline class == double, double); // fine..
decltype(my_func) is int (*)(inline class == double, double)

Also specialized structures could be written only by specifying the inline
members of them like this:

*class-name **(** =* *class-member-inline-value**,* *=* *class-member-inline-value
....**)*

As each position will refer a sequenced inline member.

So the second example could be written like:

struct S
{
    S(const inline class arg) : T(arg) { }

    const inline class T;
};


decltype(S(int)) S a{}; //will instance S::S(const inline == int), type
received from constructing temporary

S b(int); //same as above with type of 'S(=int)'

S(=int) c{}; //same as above

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_421_865202482.1419109232291
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Edit. I wanted to allow functions overloading no-matter th=
at they have inline parameters or return-value that's way I insisted on add=
ing the return-type also when instancing a specialization of it. Recently h=
owever I read that the return type can't be overloaded so specialized funct=
ions could be written just like a function declaration. So the example of '=
<span style=3D"color: rgb(0, 0, 0); font-family: monospace; background-colo=
r: rgb(250, 250, 250);">my_func</span>' can be now written like:<br><br><di=
v class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word=
-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> foo1</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> T v</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> my_func </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">f=
oo1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">double</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">do=
uble</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">// fine.. decltype(my_f=
unc) is int (*)(inline class =3D=3D double, double)</span></div></code></di=
v><span style=3D"font-family: monospace; color: rgb(136, 0, 0); background-=
color: rgb(250, 250, 250);"><br></span>Also specialized structures could be=
 written only by specifying the inline members of them like this:<br><br><i=
>class-name </i><b>(</b><b>&nbsp;=3D</b>&nbsp;<i>class-member-inline-value<=
/i><b>,</b><i>&nbsp;</i><b>=3D</b>&nbsp;<i>class-member-inline-value ...</i=
><b>)</b><br><div><b><br></b></div><div>As each position will refer a seque=
nced inline member.<br></div><div><br></div><div>So the second example coul=
d be written like:<b><br></b></div><div><br></div><div><div class=3D"pretty=
print" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word=
; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div c=
lass=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> S<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp;=
 &nbsp; S</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> arg</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">arg</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">inline</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">};</span></div></code></div><span sty=
le=3D"font-family: monospace; color: rgb(102, 102, 0); background-color: rg=
b(250, 250, 250);"><br></span><br></div><div><div class=3D"prettyprint" sty=
le=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgrou=
nd-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">dec=
ltype</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">S</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">))</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> S a</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">//will instance S::S(const inline =3D=3D int), type received from c=
onstructing temporary</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br>S b</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">//same as above with =
type of 'S(=3Dint)'</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br><br>S</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(=3D</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> c</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//same as above</span></div></code></=
div><br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_421_865202482.1419109232291--
------=_Part_420_2053110754.1419109232291--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sat, 20 Dec 2014 13:08:20 -0800
Raw View
On Saturday 20 December 2014 11:44:39 sasho648 wrote:
> The library solution proposed is invalid because we must somehow specify =
in
> the declaration that the function is going to be executed at compile-time
> (otherwise instances to it can be replaced with just assembly calls or th=
e
> function code itself).=20

I'm not sure you're aware of it, but we do have a keyword that tells the=20
compiler to try and execute a function at compile-time: constexpr.

Besides, the solution I presented and Douglas repeated allows for the compi=
ler=20
to apply the check even if the whole function isn't run at compile-time, ju=
st=20
portions of it. So you get additional checks.

> By using inline specifier we can do this, as I
> mentioned above, by specifiying either the return-value or parameters of
> function inline. Consider this:

Why can you do it with a keyword A but not keyword B?

> void DoSomething(int a);
>=20
> int main()
> {
>    DoSomething(9); //here we don't know is 'DoSomething' going to be
> executed now or just being instanced for run-time execution
> }
>=20
> void DoSomething(int a)
> {
>    if (std::is_constexpr(a))
>        static_assert(a < sz, "invalid index");
> }
>=20
> We could enable this library call only in 'constexpr' functions to avoid =
it.

Ok, but I don't think it's required to work. The above code could be left a=
s-
is and the compiler could apply the check if it optimises that far down. It=
=20
would be depedent on the implementation whether it does the extra check or=
=20
not.

However, if you do mark the function or the argument as constexpr, then the=
=20
compiler is required to evaluate at compile-time.

The big difference to today is that a constexpr function, when called with=
=20
constexpr arguments, MUST evaluate wholly at compile time. It cannot branch=
 off=20
to non-constexpr code. In other words, a constexpr function can't be used t=
o=20
perform compile-time checks for a non-constexpr operation. To be honest, I=
=20
don't think it's a problem and none of your examples would require otherwis=
e.

> But the real problem is different - why not allow proper compiler-constan=
t
> distinction. What's the problem? Why we need to introduce 'constexpr'
> functions which may take compiler-known values but may not and then add
> explicit checks for that. Isn't this stupid and non-sense? Tell me please=
 -
> I am not being offensive now but just - this is at-least not well-thought=
:

No, it's neither stupid nor nonsense.

Since a constexpr function may be evaluated at runtime too, we keep everyth=
ing=20
in one place. It's harder to make mistakes if you don't have to keep two=20
copies in sync. If you need to enforce that the arguments are compile-time=
=20
only, you can static_assert(std::is_constexpr(...)), but you can't overload=
=20
that function.

> If his idea is approved here is what happens:
>=20
> constexpr void Func(int a)
> {
>    if (std::is_constexpr(a))
>    {
>       //Then work with 'a' as if it a constant expression
>=20
>    }
>    else
>    {
>       //Else work as if 'a' is not a constant expression
>=20
>    }
> }
>=20
> Imagine we have a multiple parameters now and the mess becomes full:
>=20
> constexpr void Func(int a, int b, int c)
> {
>    if (std::is_constexpr(a) && std::is_constexpr(b) && !std::is_constexpr=
(c
> ))
>    {
>       //Then work as if 'a' and 'b' are constant expressions and 'c' is n=
ot
>=20
>    }
>    else if(std::is_constexpr(a) && !std::is_constexpr(b) && std::
> is_constexpr(c))
>    {
>       //Else work as if 'a' and 'c' are constant expressions and 'b' is n=
ot
>=20
>    }
>    else if(!std::is_constexpr(a) && std::is_constexpr(b) && std::
> is_constexpr(c))
>    {
>       //Else work as if 'b' and 'c' are constant expressions and 'a' is n=
ot
>=20
>    }
>=20
>=20
> //....
> }

Why not? Maybe that's exactly what you want. I also see no difference betwe=
en=20
the above and:

void Func(int a, int b, int c);
void Func(inline int a, int b, int c);
void Func(int a, inline int b, int c);
void Func(int a, int b, inline int c);
void Func(inline int a, inline int b, int c);
void Func(inline int a, int b, inline int c);
void Func(int a, inline int b, inline int c);
void Func(inline int a, inline int b, inline int c);

If you need all 8 combinations, then you need to write them out anyway=20
regardless of the syntax. However, with the solution based on "if", you can=
=20
write it all in a single function and merge the common code-paths without=
=20
having to call another function.

> "Automated 'type' deduction is being better implemented by using 'auto'
>=20
> > keyword as function parameter or return-value. Like this:
> >=20
> > auto FuncAdd(auto a, auto b) //also general function, which have
> > parameters and return-value of any type
> > {
> >=20
> >     return a + b;
> >=20
> > }
> > "

The above is equivalent to:

template <typename X, typename Y>
auto FuncAdd(X a, Y b)
{
 return a + b;
}

But there's no way to enforce that the types of a and b be the same. With=
=20
explicit templates, there is.

> > However, I might need to take the address of one of the functions of th=
e
> > set, which seems impossible with this syntax. Using templates, we would
> > write:
> > template <typename T> int foo1(T v);
> > auto my_func =3D &foo; // fine=E2=80=A6 decltype(my_func) is int (*)(T)
>=20
> I believe in the second example you meant something like:
>=20
> template <typename T> int foo1(T v);
> auto my_func =3D &foo1<T>; // fine=E2=80=A6 decltype(my_func) is int (*)(=
T)
>=20
> Because your example won't compile in the way you have written it.=20

Correct, Douglas's example wouldn't compile, and in fact neither does yours=
..=20
To take the address of a function, you need a concrete specialisation.

 auto my_func =3D &foo1<int>; // it's int (*)(int)
 auto my_func2 =3D &foo1<double>; // it's int (*)(double)

 // this is not a variable, it's a variable template:
 template <typename X> auto my_func_template =3D &foo1<X>;

 assert(my_func_template<int> =3D=3D my_func);

> Anyway -
> yes we could do the same by taking an address of the function with
> specialized inline parameters or if a class, inline members. Example:
>=20
> int foo1(inline class T, T v);

Please explain why we need this syntax. What does it solve that the=20
traditional way of defining templates doesn't? And would "inline class" app=
ly=20
to class templates too? How? If not, do you think it would be bad to have=
=20
different syntaxes for classes and for functions?

> auto my_func =3D &(foo1(inline class =3D=3D double, T) -> int); // fine..
> decltype(my_func) is int (*)(inline class =3D=3D double, T)

T isn't declared in this scope. I'm assuming you meant:

 auto my_func =3D &(foo1(double, double));  // if this syntax were allowed
 // the type is int (*)(double)

because, as you say:

> Such functions will be instanced without  re-specifiying the specialized
> parameters. So 'my_func' will be instanced by only specifying 'v':
>=20
> (*my_func)(9); //'v' argument =3D 9


> For classes - the type of specialized object could be retrieved by gettin=
g
> the type of temporary object or using member specialization, similar way =
as
> above:
>=20
> struct S
> {
>     S(const inline class arg) : T(arg) { }
>=20
>     const inline class T;
> };

Did the above declare a member? It seems to me that it is a forward=20
declaration only. Maybe you meant a typedef instead, so it can be reused in=
=20
other functions.

How can I do a complete specialisation of such a class? For that matter, ho=
w=20
can I partially specialise a class with inline classes?

And again: why is this superior to the current way?

> The type of a specialized struct is written using the following syntax:
>=20
> *class-name **{ **class-members **}*
>=20
> As specializing class-members will be done via '=3D=3D'. So the 'S' type =
with
> 'T' equal 'int' is:
>=20
> S { T =3D=3D int; }

You're now overloading the braces to specialise a class. To initialise an=
=20
object, we'd have:

 S{T =3D int}{0};   // I prefer =3D for assignment

What's more, you've made "T" part of the API of the class S. Right now, the=
=20
name that the templates assume inside a class are not part of the API. I ca=
n=20
select
 S<int>{0}
without caring if it's T or _Tp or something else.

> Some examples
>=20
> decltype(S(int)) S a{}; //will instance S::S(const inline =3D=3D int), ty=
pe
> received from constructing temporary
>=20
> S b(int); //same as above with type of 'S { T =3D=3D int; }'

This is a function declaration.

> S { T =3D=3D int; } c{}; //same as above
>
> In this context I must admit that expressing it is harder than templates,
> so maybe they should be still a good choice for certain goals. However fo=
r
> others my construction will be prefered.

What other goals? If you want to convince us that the syntax is better, tel=
l=20
us which cases it would be better for. You've so far only given examples th=
at=20
either don't prove they're better or you admit they're worse.

> *@Class members referencing other members*
>=20
> I wrote about this in my previous post.

Fair enough. Since they're equivalent to an inline function returning a=20
reference anyway, we can drop this for now. We can discuss a "synthetic syn=
tax=20
for inline function returning a reference" at a later time.

> *@Other comments*
>=20
> Yep - sorry my English is very bad. I believe nobody care about
> meta-programming.

You're wrong.

> When I suggested the ability to create enums by string
> someone said that he don't need this and can use script language to
> generate such things.=20

We do care about that, but that's a whole other area of discussion. You're=
=20
trying to cram everything and the kitchensink under one single feature. Tha=
t=20
will never go past the committee.

Break it down into smaller features, explain why they're beneficial.

And for creating new types by way of functions, see past discussions on the=
=20
subject and participate in the reflection SG discussions.

> Also some people think that not alerting user for
> compiler-time errors is something normal.

That depends on the definition of compile-time error. All compile-time erro=
rs=20
should be reported. The discussion was whether the code was a compile-time=
=20
error in the first place or not.

I also prefer my code to be deterministic.

 func(9);  // will report an error

 int x =3D 9;
 func(x);  // may report an error?

 func(atoi(some_string)); // never reports an error?

Either the code is valid or it isn't. Anything that doesn't affect the vali=
dity=20
of the code should not be an error. It may be a warning.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Sat, 20 Dec 2014 23:41:48 +0000
Raw View
Apologies for missing the <int> from my example, but I'm sure my
intention was obvious ;)

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Sun, 21 Dec 2014 07:34:16 -0800 (PST)
Raw View
------=_Part_217_1046862826.1419176056641
Content-Type: multipart/alternative;
 boundary="----=_Part_218_289996711.1419176056641"

------=_Part_218_289996711.1419176056641
Content-Type: text/plain; charset=UTF-8


>
> The above is equivalent to:
> template <typename X, typename Y>
> auto FuncAdd(X a, Y b)
> {
>         return a + b;
> }
> But there's no way to enforce that the types of a and b be the same. With
> explicit templates, there is.


Wrong - there is a way that you can ensure that both of the parameters are
from the same type, deduced from the first argument, by using 'decltype'
and this actually compiles just fine in 'gcc 5.0':

auto FuncAdd(auto a, decltype(a) b) ;

Life example <http://melpon.org/wandbox/permlink/FaPAiKlDwqfsmhEC>.

Please explain why we need this syntax. What does it solve that the
> traditional way of defining templates doesn't? And would "inline class"
> apply
> to class templates too? How? If not, do you think it would be bad to have
> different syntaxes for classes and for functions?


It's not required but it for me it's naturally to be added as there is much
similarity with 'constexpr' parameters and templates as they both are
evaluated at compile-time. But if you want a reason - I personally think
it's more easy to write 'inline' parameters, instead of templates. But for
now let's abstract from it - I was just replaying 'Douglas Boffey' post.
Let's continue with the concept of 'inline' or 'constexpr' parameters.

Why not? Maybe that's exactly what you want. I also see no difference
> between
> the above and:
> void Func(int a, int b, int c);
> void Func(inline int a, int b, int c);
> void Func(int a, inline int b, int c);
> void Func(int a, int b, inline int c);
> void Func(inline int a, inline int b, int c);
> void Func(inline int a, int b, inline int c);
> void Func(int a, inline int b, inline int c);
> void Func(inline int a, inline int b, inline int c);
> If you need all 8 combinations, then you need to write them out anyway
> regardless of the syntax. However, with the solution based on "if", you
> can
> write it all in a single function and merge the common code-paths without
> having to call another function.


Why don't we stop using types and detect them in 'if' statements? That's
the 'C++' language - it's a type-one.

Why can you do it with a keyword A but not keyword B?


I don't have nothing against to be 'constexpr' too, after it is introduced
in the language already and no going-back is possible.

So as 'constexpr' functions could return only 'constexpr' values - we could
thought them as an function declared with return value of type 'constexpr',
if we replace 'inline' with 'constexpr'. And in the case we could declare
'constexpr' parameters.

That depends on the definition of compile-time error. All compile-time
> errors
> should be reported. The discussion was whether the code was a compile-time
> error in the first place or not.
> I also prefer my code to be deterministic.
>         func(9);                // will report an error
>         int x = 9;
>         func(x);                // may report an error?
>         func(atoi(some_string));        // never reports an error?
> Either the code is valid or it isn't. Anything that doesn't affect the
> validity
> of the code should not be an error. It may be a warning.


I believe code which is sure 'UB' or instance functions with parameters not
supported by them is exactly invalid code.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_218_289996711.1419176056641
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); =
border-left-style: solid; padding-left: 1ex;">The above is equivalent to:&n=
bsp;<br>template &lt;typename X, typename Y&gt;&nbsp;<br>auto FuncAdd(X a, =
Y b)&nbsp;<br>{&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;re=
turn a + b;&nbsp;<br>}&nbsp;<br>But there's no way to enforce that the type=
s of a and b be the same. With&nbsp;<br>explicit templates, there is.&nbsp;=
</blockquote><div><br></div><div>Wrong - there is a way that you can ensure=
 that both of the parameters are from the same type, deduced from the first=
 argument, by using 'decltype' and this actually compiles just fine in 'gcc=
 5.0':<br><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187=
, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cla=
ss=3D"styled-by-prettify">FuncAdd</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> a</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">decltype</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">a</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span></div></code></div></div><div><br></div><div>Life <a href=3D"htt=
p://melpon.org/wandbox/permlink/FaPAiKlDwqfsmhEC">example</a>.</div><div><b=
r></div><div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); bord=
er-left-style: solid; padding-left: 1ex;">Please explain why we need this s=
yntax. What does it solve that the&nbsp;<br>traditional way of defining tem=
plates doesn't? And would "inline class" apply&nbsp;<br>to class templates =
too? How? If not, do you think it would be bad to have&nbsp;<br>different s=
yntaxes for classes and for functions?&nbsp;</blockquote><br></div><div>It'=
s not required but it for me it's naturally to be added as there is much si=
milarity with 'constexpr' parameters and templates as they both are evaluat=
ed at compile-time. But if you want a reason - I personally think it's more=
 easy to write 'inline' parameters, instead of templates. But for now let's=
 abstract from it - I was just replaying '<span class=3D"_username" style=
=3D"white-space: nowrap;"><span class=3D"GJHURADA0B g-hovercard" data-useri=
d=3D"105548083684085355974" data-name=3D"Douglas Boffey">Douglas Boffey</sp=
an></span>' post. Let's continue with the concept of 'inline' or 'constexpr=
' parameters.</div><div><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: r=
gb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Why not? M=
aybe that's exactly what you want. I also see no difference between&nbsp;<b=
r>the above and:&nbsp;<br>void Func(int a, int b, int c);&nbsp;<br>void Fun=
c(inline int a, int b, int c);&nbsp;<br>void Func(int a, inline int b, int =
c);&nbsp;<br>void Func(int a, int b, inline int c);&nbsp;<br>void Func(inli=
ne int a, inline int b, int c);&nbsp;<br>void Func(inline int a, int b, inl=
ine int c);&nbsp;<br>void Func(int a, inline int b, inline int c);&nbsp;<br=
>void Func(inline int a, inline int b, inline int c);&nbsp;<br>If you need =
all 8 combinations, then you need to write them out anyway&nbsp;<br>regardl=
ess of the syntax. However, with the solution based on "if", you can&nbsp;<=
br>write it all in a single function and merge the common code-paths withou=
t&nbsp;<br>having to call another function.&nbsp;</blockquote><div><br></di=
v><div>Why don't we stop using types and detect them in 'if' statements? Th=
at's the 'C++' language - it's a type-one.</div><div><br></div><blockquote =
class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left-width=
: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; pad=
ding-left: 1ex;">Why can you do it with a keyword A but not keyword B?&nbsp=
;</blockquote><div><br></div><div>I don't have nothing against to be 'const=
expr' too, after it is introduced in the language already and no going-back=
 is possible.&nbsp;<br><br>So as 'constexpr' functions could return only 'c=
onstexpr' values - we could thought them as an function declared with retur=
n value of type 'constexpr', if we replace 'inline' with 'constexpr'. And i=
n the case we could declare 'constexpr' parameters.</div><div><br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-l=
eft-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: s=
olid; padding-left: 1ex;">That depends on the definition of compile-time er=
ror. All compile-time errors&nbsp;<br>should be reported. The discussion wa=
s whether the code was a compile-time&nbsp;<br>error in the first place or =
not.&nbsp;<br>I also prefer my code to be deterministic.&nbsp;<br>&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;func(9);&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<wbr>&nbsp;&nbsp;//=
 will report an error&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;int x =3D 9;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f=
unc(x);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;<wbr>&nbsp;&nbsp;// may report an error?&nbsp;<br>&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;func(atoi(some_string)<wbr>);&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// never reports an error?&nbsp;<b=
r>Either the code is valid or it isn't. Anything that doesn't affect the va=
lidity&nbsp;<br>of the code should not be an error. It may be a warning.&nb=
sp;</blockquote><div><br></div><div>I believe code which is sure 'UB' or in=
stance functions with parameters not supported by them is exactly invalid c=
ode.&nbsp;</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_218_289996711.1419176056641--
------=_Part_217_1046862826.1419176056641--

.


Author: sasho648 <sasho648@mail.bg>
Date: Sun, 21 Dec 2014 07:45:07 -0800 (PST)
Raw View
------=_Part_1973_1195389466.1419176707151
Content-Type: multipart/alternative;
 boundary="----=_Part_1974_1201237377.1419176707151"

------=_Part_1974_1201237377.1419176707151
Content-Type: text/plain; charset=UTF-8

The problem is best described here
<http://www.codeproject.com/Articles/8293/Design-by-Contract-in-C>and
solved using macros, and as it seems some of them are VC++ dependant, which
is something that new 'C++' is trying to get rid of.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1974_1201237377.1419176707151
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The problem is best described <a href=3D"http://www.codepr=
oject.com/Articles/8293/Design-by-Contract-in-C">here </a>and solved using =
macros, and as it seems some of them are VC++ dependant, which is something=
 that new 'C++' is trying to get rid of.</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1974_1201237377.1419176707151--
------=_Part_1973_1195389466.1419176707151--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sun, 21 Dec 2014 09:25:13 -0800
Raw View
On Sunday 21 December 2014 07:34:16 sasho648 wrote:
> I don't have nothing against to be 'constexpr' too, after it is introduced
> in the language already and no going-back is possible.
>
> So as 'constexpr' functions could return only 'constexpr' values - we could
> thought them as an function declared with return value of type 'constexpr',
> if we replace 'inline' with 'constexpr'. And in the case we could declare
> 'constexpr' parameters.

Considering constexpr has been in the language for two revisions of the
standard already, does this paragraph mean you are ok with replacing "inline"
with "constexpr" in your proposal?

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: sasho648 <sasho648@mail.bg>
Date: Sun, 21 Dec 2014 09:33:34 -0800 (PST)
Raw View
------=_Part_364_1526266772.1419183214619
Content-Type: multipart/alternative;
 boundary="----=_Part_365_273473589.1419183214620"

------=_Part_365_273473589.1419183214620
Content-Type: text/plain; charset=UTF-8

Does it matter what the keyword is?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_365_273473589.1419183214620
Content-Type: text/html; charset=UTF-8

<div dir="ltr">Does it matter what the keyword is?&nbsp;</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_365_273473589.1419183214620--
------=_Part_364_1526266772.1419183214619--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sun, 21 Dec 2014 13:31:05 -0800
Raw View
On Sunday 21 December 2014 09:33:34 sasho648 wrote:
> Does it matter what the keyword is?

Yes.

PS: please get a decent mail client that will set the proper In-Reply-To
header to the message you're replying to. All your messages on this thread
seem to come as replies to the original post.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.