Topic: Towards a constexpr usable Standard Library
Author: Antony Polukhin <antoshkka@gmail.com>
Date: Wed, 5 Aug 2015 21:51:35 +0300
Raw View
--001a11391e0660fc38051c94e4e2
Content-Type: text/plain; charset=UTF-8
Standard Library provides a great collection of containers and algorithms,
which currently lack constexpr support. Even a simple constexpr usage
requires reimplementing a big bunch of Standard Library. Consider the
simple example:
#include <array>
#include <algorithm>
int main() {
// OK
constexpr std::array<char, 6> a { 'H', 'e', 'l', 'l', 'o' };
// Failures:
// * std::find is not constexpr
// * std::array::rbegin(), std::array::rend() is not constexpr
constexpr auto it = std::find(a.rbegin(), a.rend(), 'H');
}
To make the example work user will have to reimplement std::array and
std::find by copy-pasting source codes and adding constexpr keywords...
Here's an draft attempt to make things better (short version):
std::array is a high level wrapper for an array, so make it constexpr just
like a low level arrays are.
Change definition of array in "23.3.2.1 Class template array overview" by
adding constexpr to almost every method:
namespace std {
template <class T, size_t N>
struct array {
// types:
typedef T& reference;
typedef const T& const_reference;
typedef implementation-defined iterator;
typedef implementation-defined const_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
T elems[N]; // exposition only
// no explicit construct/copy/destroy for aggregate type
void fill(const T& u);
void swap(array&) noexcept(noexcept(swap(declval<T&>(),
declval<T&>())));
// iterators:
constexpr iterator begin() noexcept;
constexpr const_iterator begin() const noexcept;
constexpr iterator end() noexcept;
constexpr const_iterator end() const noexcept;
constexpr reverse_iterator rbegin() noexcept;
constexpr const_reverse_iterator rbegin() const noexcept;
constexpr reverse_iterator rend() noexcept;
constexpr const_reverse_iterator rend() const noexcept;
constexpr const_iterator cbegin() const noexcept;
constexpr const_iterator cend() const noexcept;
constexpr const_reverse_iterator crbegin() const noexcept;
constexpr const_reverse_iterator crend() const noexcept;
// capacity:
constexpr bool empty() const noexcept;
constexpr size_type size() const noexcept;
constexpr size_type max_size() const noexcept;
// element access:
constexpr reference operator[](size_type n);
constexpr const_reference operator[](size_type n) const;
constexpr reference at(size_type n);
constexpr const_reference at(size_type n) const;
constexpr reference front();
constexpr const_reference front() const;
constexpr reference back();
constexpr const_reference back() const;
constexpr T * data() noexcept;
constexpr const T * data() const noexcept;
};
}
This brings us the requirement to make std::reverse_iterator constexpr
compatible. Change the std::reverse_iterator definition in "24.5.1.1 Class
template reverse_iterator" by adding constexpr:
namespace std {
template <class Iterator>
class reverse_iterator {
public:
// ...
constexpr explicit reverse_iterator(Iterator x);
template <class U> constexpr reverse_iterator(const
reverse_iterator<U>& u);
template <class U> constexpr reverse_iterator& operator=(const
reverse_iterator<U>& u);
constexpr Iterator base() const;
// explicit
constexpr reference operator*() const;
constexpr pointer operator->() const;
constexpr reverse_iterator& operator++(int);
constexpr reverse_iterator operator--();
constexpr reverse_iterator& operator--(int);
constexpr reverse_iterator operator++();
constexpr reverse_iterator operator+ (difference_type n) const;
constexpr reverse_iterator& operator+=(difference_type n);
constexpr reverse_iterator operator- (difference_type n) const;
constexpr reverse_iterator& operator-=(difference_type n);
constexpr unspecified operator[](difference_type n) const;
protected:
Iterator current;
};
template <class Iterator1, class Iterator2>
constexpr bool operator==(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template <class Iterator1, class Iterator2>
constexpr bool operator<(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template <class Iterator1, class Iterator2>
constexpr bool operator!=(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template <class Iterator1, class Iterator2>
constexpr bool operator>(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template <class Iterator1, class Iterator2>
constexpr bool operator>=(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template <class Iterator1, class Iterator2>
constexpr bool operator<=(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
template <class Iterator1, class Iterator2>
constexpr auto operator-(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y) -> decltype(y.base() - x.base());
template <class Iterator>
constexpr reverse_iterator<Iterator> operator+(
typename reverse_iterator<Iterator>::difference_type n,
const reverse_iterator<Iterator>& x);
template <class Iterator>
constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
}
Same changes must be applied to iterator, move_iterator. Free standing
functions size, begin, end, cbegin, cend already have constexpr modifier.
That was the simple part. Now the hard part. It's time to mark with
constexpr the algorithms. All the non-modifying algorithms could be
modified to support constexpr(min/max algorithms are already constexpr).
Modifying algorithms (like with std::fill, std::copy) could not be
currently marked as constexpr because they may use C functions for some
cases (std::fill uses std::memsert for PODs, std::copy uses std::memmove
for PODs). There's no known to me easy solution for such case: either
memset/memcpy/... methods must be marked as constexpr which may be a
problem, or an std::is_constexpr_v builtin trait must be invented that will
allow to Standard Library developers to fallback to nonoptimized version
(potential ODR violation). So leaving those algorithms without constexpr
now. There are also some practical troubles with GCC, wich in some cases
could not assign to a dereferenced iterator.
Some more stuff that miss constexpr and left out of scope of this letter:
(simple)std::complex and all it's free standing functions, (hard)almost all
the functions in <cstring>, (simple)std::bitset and almost all it's free
standing functions, (hard)almost all of the <cmath> functions...
Significant constexpr additions will affect compilation times. As a
workaround a note to the Standard could be added: "Compiler vendors may
provide header wide attrbutes or pragmas to disable checks and
instantiations of constexpr methods and functions.". For example GCC may do
that for `#pragma GCC system_header` headers.
Someone, please guide me through the current process of requesting
constexpr additions to Standard Library. Must it be done as a DR or as a
proposal? Is it better to break down the proposal to multiple smaller
proposals? Where shall I send the proposal/DR? Any comments and notes are
welcomed.
--
Best regards,
Antony Polukhin
--
---
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/.
--001a11391e0660fc38051c94e4e2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Standard Library provides a great collection of containers=
and algorithms, which currently lack constexpr support. Even a simple cons=
texpr usage requires reimplementing a big bunch of Standard Library. Consid=
er the simple example:<br><br>#include <array><br>#include <algori=
thm><br>=C2=A0<br>int main() {<br>=C2=A0=C2=A0=C2=A0 // OK<br>=C2=A0=C2=
=A0=C2=A0 constexpr std::array<char, 6> a { 'H', 'e',=
'l', 'l', 'o' };<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=
=C2=A0=C2=A0 // Failures:<br>=C2=A0=C2=A0=C2=A0 // * std::find is not const=
expr<br>=C2=A0=C2=A0=C2=A0 // * std::array::rbegin(), std::array::rend() is=
not constexpr<br>=C2=A0=C2=A0=C2=A0 constexpr auto it =3D std::find(a.rbeg=
in(), a.rend(), 'H');<br>}<br><br>To make the example work user wil=
l have to reimplement std::array and std::find by copy-pasting source codes=
and adding constexpr keywords...<br><br>Here's an draft attempt to mak=
e things better (short version):<br><br>std::array is a high level wrapper =
for an array, so make it constexpr just like a low level arrays are.<br>Cha=
nge definition of array in "23.3.2.1=C2=A0 Class template array overvi=
ew" by adding constexpr to almost every method:<br><br>namespace std {=
<br>template <class T, size_t N><br>struct array {<br>=C2=A0=C2=A0=C2=
=A0 // types:<br>=C2=A0=C2=A0=C2=A0 typedef T&=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reference;<br>=C2=A0=C2=A0=C2=A0 typed=
ef const T&=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const_reference;<br>=C2=A0=C2=A0=C2=
=A0 typedef=C2=A0=C2=A0=C2=A0 implementation-defined=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 iterator;<br>=C2=A0=C2=
=A0=C2=A0 typedef=C2=A0=C2=A0=C2=A0 implementation-defined=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const_iterator;<b=
r>=C2=A0=C2=A0=C2=A0 typedef size_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 si=
ze_type;<br>=C2=A0=C2=A0=C2=A0 typedef ptrdiff_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 differen=
ce_type;<br>=C2=A0=C2=A0=C2=A0 typedef T=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value_type;<br>=C2=A0=C2=A0=C2=A0 typedef=
T*=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pointer;<br=
>=C2=A0=C2=A0=C2=A0 typedef const T*=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const_pointer;=
<br>=C2=A0=C2=A0=C2=A0 typedef std::reverse_iterator<iterator>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reverse_iterator;<br>=C2=A0=C2=A0=C2=A0 type=
def std::reverse_iterator<const_iterator> const_reverse_iterator;<br>=
=C2=A0=C2=A0=C2=A0 T=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 elems[N];=C2=A0=C2=
=A0=C2=A0 // exposition only<br><br>=C2=A0=C2=A0=C2=A0 // no explicit const=
ruct/copy/destroy for aggregate type<br>=C2=A0=C2=A0=C2=A0 void fill(const =
T& u);<br>=C2=A0=C2=A0=C2=A0 void swap(array&) noexcept(noexcept(sw=
ap(declval<T&>(), declval<T&>())));<br>=C2=A0=C2=A0=C2=
=A0 // iterators:<br>=C2=A0=C2=A0=C2=A0 constexpr iterator=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 begin=
() noexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr const_iterator=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 begin() const noexcept;<br>=C2=A0=C2=A0=
=C2=A0 constexpr iterator=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 end() noexcept;<br>=C2=A0=C2=A0=C2=A0 =
constexpr const_iterator=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 en=
d() const noexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr reverse_iterator=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rbegin() noexcept;<br>=C2=A0=C2=A0=C2=A0 con=
stexpr const_reverse_iterator rbegin() const noexcept;<br>=C2=A0=C2=A0=C2=
=A0 constexpr reverse_iterator=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rend() n=
oexcept;<br><br>=C2=A0=C2=A0=C2=A0 constexpr const_reverse_iterator rend() =
const noexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr const_iterator=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cbegin() const noexcept;<br>=C2=A0=C2=
=A0=C2=A0 constexpr const_iterator=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 cend() const noexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr const_reve=
rse_iterator crbegin() const noexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr cons=
t_reverse_iterator crend() const noexcept;<br>=C2=A0=C2=A0=C2=A0 // capacit=
y:<br>=C2=A0=C2=A0=C2=A0 constexpr bool=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 empty=
() const noexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr size_type size() const n=
oexcept;<br>=C2=A0=C2=A0=C2=A0 constexpr size_type max_size() const noexcep=
t;<br>=C2=A0=C2=A0=C2=A0 // element access:<br>=C2=A0=C2=A0=C2=A0 constexpr=
reference=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 operator[](size_type n);<br>=
=C2=A0=C2=A0=C2=A0 constexpr const_reference operator[](size_type n) const;=
<br>=C2=A0=C2=A0=C2=A0 constexpr reference=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 at(size_type n);<br>=C2=A0=C2=A0=C2=A0 constexpr const_reference at(siz=
e_type n) const;<br>=C2=A0=C2=A0=C2=A0 constexpr reference=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 front();<br>=C2=A0=C2=A0=C2=A0 constexpr const_refere=
nce front() const;<br>=C2=A0=C2=A0=C2=A0 constexpr reference=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 back();<br>=C2=A0=C2=A0=C2=A0 constexpr const_referen=
ce back() const;<br>=C2=A0=C2=A0=C2=A0 constexpr T *=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 data() noexcept;<br>=C2=
=A0=C2=A0=C2=A0 constexpr const T * data() const noexcept;<br>};<br>}<br><b=
r>This brings us the requirement to make std::reverse_iterator constexpr co=
mpatible. Change the std::reverse_iterator definition in "24.5.1.1 Cla=
ss template reverse_iterator" by adding constexpr:<br><br>namespace st=
d {<br>template <class Iterator><br>class reverse_iterator {<br>=C2=
=A0=C2=A0=C2=A0 public:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // ..=
..<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr explicit reverse_=
iterator(Iterator x);<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 templat=
e <class U> constexpr reverse_iterator(const reverse_iterator<U>=
;& u);<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 template <class=
U> constexpr reverse_iterator& operator=3D(const reverse_iterator&l=
t;U>& u);<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr It=
erator base() const;<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // expli=
cit<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr reference opera=
tor*() const;<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr point=
er operator->() const;<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 con=
stexpr reverse_iterator& operator++(int);<br>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 constexpr reverse_iterator operator--();<br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr reverse_iterator& operator--(i=
nt);<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr reverse_iterat=
or operator++();<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr reverse_iterator operator+ (=
difference_type n) const;<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 con=
stexpr reverse_iterator& operator+=3D(difference_type n);<br>=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr reverse_iterator operator- (dif=
ference_type n) const;<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 conste=
xpr reverse_iterator& operator-=3D(difference_type n);<br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 constexpr unspecified operator[](difference_=
type n) const;<br>=C2=A0=C2=A0=C2=A0 protected:<br>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 Iterator current;<br>};<br><br>template <class Iterat=
or1, class Iterator2><br>constexpr bool operator=3D=3D(<br>=C2=A0=C2=A0=
=C2=A0 const reverse_iterator<Iterator1>& x,<br>=C2=A0=C2=A0=C2=
=A0 const reverse_iterator<Iterator2>& y);<br>template <class =
Iterator1, class Iterator2><br>constexpr bool operator<(<br>=C2=A0=C2=
=A0=C2=A0 const reverse_iterator<Iterator1>& x,<br>=C2=A0=C2=A0=
=C2=A0 const reverse_iterator<Iterator2>& y);<br>template <cla=
ss Iterator1, class Iterator2><br>constexpr bool operator!=3D(<br>=C2=A0=
=C2=A0=C2=A0 const reverse_iterator<Iterator1>& x,<br>=C2=A0=C2=
=A0=C2=A0 const reverse_iterator<Iterator2>& y);<br>template <=
class Iterator1, class Iterator2><br>constexpr bool operator>(<br>=C2=
=A0=C2=A0=C2=A0 const reverse_iterator<Iterator1>& x,<br>=C2=A0=
=C2=A0=C2=A0 const reverse_iterator<Iterator2>& y);<br>template &=
lt;class Iterator1, class Iterator2><br>constexpr bool operator>=3D(<=
br>=C2=A0=C2=A0=C2=A0 const reverse_iterator<Iterator1>& x,<br>=
=C2=A0=C2=A0=C2=A0 const reverse_iterator<Iterator2>& y);<br>temp=
late <class Iterator1, class Iterator2><br>constexpr bool operator<=
;=3D(<br>=C2=A0=C2=A0=C2=A0 const reverse_iterator<Iterator1>& x,=
<br>=C2=A0=C2=A0=C2=A0 const reverse_iterator<Iterator2>& y);<br>=
template <class Iterator1, class Iterator2><br>constexpr auto operato=
r-(<br>=C2=A0=C2=A0=C2=A0 const reverse_iterator<Iterator1>& x,<b=
r>=C2=A0=C2=A0=C2=A0 const reverse_iterator<Iterator2>& y) -> =
decltype(y.base() - x.base());<br>template <class Iterator><br>conste=
xpr reverse_iterator<Iterator> operator+(<br>=C2=A0=C2=A0=C2=A0 typen=
ame reverse_iterator<Iterator>::difference_type n,<br>=C2=A0=C2=A0=C2=
=A0 const reverse_iterator<Iterator>& x);<br>template <class I=
terator><br>constexpr reverse_iterator<Iterator> make_reverse_iter=
ator(Iterator i);<br>}<br><br>Same changes must be applied to iterator, mov=
e_iterator. Free standing functions size, begin, end, cbegin, cend already =
have constexpr modifier.<br><br>That was the simple part. Now the hard part=
.. It's time to mark with constexpr the algorithms. All the non-modifyin=
g algorithms could be modified to support constexpr(min/max algorithms are =
already constexpr). Modifying algorithms (like with std::fill, std::copy) c=
ould not be currently marked as constexpr because they may use C functions =
for some cases (std::fill uses std::memsert for PODs, std::copy uses std::m=
emmove for PODs). There's no known to me easy solution for such case: e=
ither memset/memcpy/... methods must be marked as constexpr which may be a =
problem, or an std::is_constexpr_v builtin trait must be invented that will=
allow to Standard Library developers to fallback to nonoptimized version (=
potential ODR violation). So leaving those algorithms without constexpr now=
.. There are also some practical troubles with GCC, wich in some cases could=
not assign to a dereferenced iterator.<br><br>Some more stuff that miss co=
nstexpr and left out of scope of this letter: (simple)std::complex and all =
it's free standing functions, (hard)almost all the functions in <cst=
ring>, (simple)std::bitset and almost all it's free standing functio=
ns, (hard)almost all of the <cmath> functions...<br><br>Significant c=
onstexpr additions will affect compilation times. As a workaround a note to=
the Standard could be added: "Compiler vendors may provide header wid=
e attrbutes or pragmas to disable checks and instantiations of constexpr me=
thods and functions.". For example GCC may do that for `#pragma GCC sy=
stem_header` headers.<br><br><br>Someone, please guide me through the curre=
nt process of requesting constexpr additions to Standard Library. Must it b=
e done as a DR or as a proposal? Is it better to break down the proposal to=
multiple smaller proposals? Where shall I send the proposal/DR? Any commen=
ts and notes are welcomed.<br><br clear=3D"all"><br>-- <br><div class=3D"gm=
ail_signature">Best regards,<br>Antony Polukhin</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" 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 />
--001a11391e0660fc38051c94e4e2--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 5 Aug 2015 15:53:41 -0700 (PDT)
Raw View
------=_Part_313_89039979.1438815221153
Content-Type: multipart/alternative;
boundary="----=_Part_314_1387861632.1438815221153"
------=_Part_314_1387861632.1438815221153
Content-Type: text/plain; charset=UTF-8
Even if it starts as a defect report, it's such a large change that it
could only be addressed fully as a proposal. The ISO C++ site has details
on formally making proposals <https://isocpp.org/std/submit-a-proposal>.
If you want to make a formal proposal however, it will need to be more
complete than just "I'd like more things in the standard library to be
`constexpr`." You're going to have to do the work of looking at various
functions/types/etc and seeing which ones can and cannot be `constexpr`. If
you really want to impress people, you'll also implement `constexpr`
versions of them that works across compilers.
--
---
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_314_1387861632.1438815221153
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Even if it starts as a defect report, it's such a=
large change that it could only be addressed fully as a proposal. The ISO =
C++ site has details on <a href=3D"https://isocpp.org/std/submit-a-proposal=
">formally making proposals</a>.<br></div><br>If you want to make a formal =
proposal however, it will need to be more complete than just "I'd =
like more things in the standard library to be `constexpr`." You'r=
e going to have to do the work of looking at various functions/types/etc an=
d seeing which ones can and cannot be `constexpr`. If you really want to im=
press people, you'll also implement `constexpr` versions of them that w=
orks across compilers.<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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_314_1387861632.1438815221153--
------=_Part_313_89039979.1438815221153--
.
Author: Antony Polukhin <antoshkka@gmail.com>
Date: Thu, 6 Aug 2015 23:46:51 +0300
Raw View
--001a1137bb8c699267051caa9e86
Content-Type: text/plain; charset=UTF-8
2015-08-06 1:53 GMT+03:00 Nicol Bolas <jmckesson@gmail.com>:
> Even if it starts as a defect report, it's such a large change that it
> could only be addressed fully as a proposal. The ISO C++ site has details
> on formally making proposals <https://isocpp.org/std/submit-a-proposal>.
>
> If you want to make a formal proposal however, it will need to be more
> complete than just "I'd like more things in the standard library to be
> `constexpr`." You're going to have to do the work of looking at various
> functions/types/etc and seeing which ones can and cannot be `constexpr`. If
> you really want to impress people, you'll also implement `constexpr`
> versions of them that works across compilers.
>
Thanks for the notes and hints!
I've started writing the proposal.
I've also implemented and tested on GCC 5.2 and CLANG 3.6 all the
functionality that would be in the proposal:
https://github.com/apolukhin/constexpr_additions
--
Best regards,
Antony Polukhin
--
---
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/.
--001a1137bb8c699267051caa9e86
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-08-06 1:53 GMT+03:00 Nicol Bolas <span dir=3D"ltr"><<a href=3D"mailto:j=
mckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>></span>:<b=
r><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Even if it starts as=
a defect report, it's such a large change that it could only be addres=
sed fully as a proposal. The ISO C++ site has details on <a href=3D"https:/=
/isocpp.org/std/submit-a-proposal" target=3D"_blank">formally making propos=
als</a>.<br></div><br>If you want to make a formal proposal however, it wil=
l need to be more complete than just "I'd like more things in the =
standard library to be `constexpr`." You're going to have to do th=
e work of looking at various functions/types/etc and seeing which ones can =
and cannot be `constexpr`. If you really want to impress people, you'll=
also implement `constexpr` versions of them that works across compilers.</=
div></blockquote><div><br></div><div>Thanks for the notes and hints!<br><br=
><div>I've started writing the proposal.<br></div>I've
also implemented and tested on GCC 5.2 and CLANG 3.6 all the=20
functionality that would be in the proposal:=20
<a href=3D"https://github.com/apolukhin/constexpr_additions">https://github=
..com/apolukhin/constexpr_additions</a> <br></div></div><br>-- <br><div clas=
s=3D"gmail_signature">Best regards,<br>Antony Polukhin</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" 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 />
--001a1137bb8c699267051caa9e86--
.
Author: rhalbersma@gmail.com
Date: Fri, 7 Aug 2015 06:36:22 -0700 (PDT)
Raw View
------=_Part_98_1173219952.1438954582833
Content-Type: multipart/alternative;
boundary="----=_Part_99_1627047326.1438954582833"
------=_Part_99_1627047326.1438954582833
Content-Type: text/plain; charset=UTF-8
On Thursday, August 6, 2015 at 10:46:53 PM UTC+2, Antony Polukhin wrote:
>
> 2015-08-06 1:53 GMT+03:00 Nicol Bolas <jmck...@gmail.com <javascript:>>:
>
>> Even if it starts as a defect report, it's such a large change that it
>> could only be addressed fully as a proposal. The ISO C++ site has details
>> on formally making proposals <https://isocpp.org/std/submit-a-proposal>.
>>
>> If you want to make a formal proposal however, it will need to be more
>> complete than just "I'd like more things in the standard library to be
>> `constexpr`." You're going to have to do the work of looking at various
>> functions/types/etc and seeing which ones can and cannot be `constexpr`. If
>> you really want to impress people, you'll also implement `constexpr`
>> versions of them that works across compilers.
>>
>
> Thanks for the notes and hints!
>
> I've started writing the proposal.
> I've also implemented and tested on GCC 5.2 and CLANG 3.6 all the
> functionality that would be in the proposal:
> https://github.com/apolukhin/constexpr_additions
>
> --
> Best regards,
> Antony Polukhin
>
Great initiative!
I have been using a drop-in replacement constexpr-array for quite a while
now, essentially without hiccups. Implementation is on
BitBucket https://bitbucket.org/rhalbersma/xstd/src/42553df6107623c71163f104b6f3cc550c245b4b/include/xstd/array.hpp?at=default
As you explain, adding constexpr is kind of viral because I also had to
change header like <algorithm>, <iterator> and <utility> to constexp-ify
fill_n, swap_ranges, equal, lexicographical_compare, reverse_iterator and
swap. You can find modified headers for that as well.
I am using this array as a building block for a constexpr bitset (with some
other modifications, including bit iterators). That code is not as clean
and ready for discussion. But in principle one could make all
non-allocating container-like classes (array, bitset, pair, tuple,
valarray, complex, etc.) completely constexpr.
As you point out, only C functions like memset cannot be changed by library
writers. I solved that by copying the libc++ code where memset is only
called in fill_n for overloads for char ranges (IIRC). So you get 95% of
the benefits with only sprinkling some 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_99_1627047326.1438954582833
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<br><br>On Thursday, August 6, 2015 at 10:46:53 PM UTC+2, Antony Polukhin w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><di=
v class=3D"gmail_quote">2015-08-06 1:53 GMT+03:00 Nicol Bolas <span dir=3D"=
ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"Q8B9IP6XEAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:=
';return true;" onclick=3D"this.href=3D'javascript:';return tru=
e;">jmck...@gmail.com</a>></span>:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><di=
v dir=3D"ltr"><div>Even if it starts as a defect report, it's such a la=
rge change that it could only be addressed fully as a proposal. The ISO C++=
site has details on <a href=3D"https://isocpp.org/std/submit-a-proposal" t=
arget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://w=
ww.google.com/url?q\75https%3A%2F%2Fisocpp.org%2Fstd%2Fsubmit-a-proposal\46=
sa\75D\46sntz\0751\46usg\75AFQjCNGlLyCIYYQUZNTTJdUEpCYxvwG8Ig';return t=
rue;" onclick=3D"this.href=3D'https://www.google.com/url?q\75https%3A%2=
F%2Fisocpp.org%2Fstd%2Fsubmit-a-proposal\46sa\75D\46sntz\0751\46usg\75AFQjC=
NGlLyCIYYQUZNTTJdUEpCYxvwG8Ig';return true;">formally making proposals<=
/a>.<br></div><br>If you want to make a formal proposal however, it will ne=
ed to be more complete than just "I'd like more things in the stan=
dard library to be `constexpr`." You're going to have to do the wo=
rk of looking at various functions/types/etc and seeing which ones can and =
cannot be `constexpr`. If you really want to impress people, you'll als=
o implement `constexpr` versions of them that works across compilers.</div>=
</blockquote><div><br></div><div>Thanks for the notes and hints!<br><br><di=
v>I've started writing the proposal.<br></div>I've
also implemented and tested on GCC 5.2 and CLANG 3.6 all the=20
functionality that would be in the proposal:=20
<a href=3D"https://github.com/apolukhin/constexpr_additions" target=3D"_bla=
nk" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://www.google.com=
/url?q\75https%3A%2F%2Fgithub.com%2Fapolukhin%2Fconstexpr_additions\46sa\75=
D\46sntz\0751\46usg\75AFQjCNGLH-pBc9D1TSC9qo7o2dvL69mnng';return true;"=
onclick=3D"this.href=3D'https://www.google.com/url?q\75https%3A%2F%2Fg=
ithub.com%2Fapolukhin%2Fconstexpr_additions\46sa\75D\46sntz\0751\46usg\75AF=
QjCNGLH-pBc9D1TSC9qo7o2dvL69mnng';return true;">https://github.com/apol=
ukhin/<wbr>constexpr_additions</a> <br></div></div><br>-- <br><div>Best reg=
ards,<br>Antony Polukhin</div></div></div></blockquote><div><br></div><div>=
Great initiative!=C2=A0</div><div><br></div><div>I have been using a drop-i=
n replacement constexpr-array for quite a while now, essentially without hi=
ccups. Implementation is on BitBucket=C2=A0https://bitbucket.org/rhalbersma=
/xstd/src/42553df6107623c71163f104b6f3cc550c245b4b/include/xstd/array.hpp?a=
t=3Ddefault=C2=A0</div><div><br></div><div>As you explain, adding constexpr=
is kind of viral because I also had to change header like <algorithm>=
;, <iterator> and <utility> to constexp-ify fill_n, swap_ranges=
, equal, lexicographical_compare, reverse_iterator and swap. You can find m=
odified headers for that as well.=C2=A0</div><div><br></div><div>I am using=
this array as a building block for a constexpr bitset (with some other mod=
ifications, including bit iterators). That code is not as clean and ready f=
or discussion. But in principle one could make all non-allocating container=
-like classes (array, bitset, pair, tuple, valarray, complex, etc.) complet=
ely constexpr.=C2=A0</div><div><br></div><div>As you point out, only C func=
tions like memset cannot be changed by library writers. I solved that by co=
pying the libc++ code where memset is only called in fill_n for overloads f=
or char ranges (IIRC). So you get 95% of the benefits with only sprinkling =
some keywords.</div><div><br></div><div><pre style=3D"font-family: Consolas=
, Menlo, 'Liberation Mono', Courier, monospace; font-size: 12px; li=
ne-height: 1.4; color: rgb(51, 51, 51);"><br></pre></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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_99_1627047326.1438954582833--
------=_Part_98_1173219952.1438954582833--
.
Author: ant.bikineev@gmail.com
Date: Sat, 4 Jun 2016 22:30:12 -0700 (PDT)
Raw View
------=_Part_3148_73751127.1465104612319
Content-Type: multipart/alternative;
boundary="----=_Part_3149_746959250.1465104612319"
------=_Part_3149_746959250.1465104612319
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I've just pushed a patch <http://reviews.llvm.org/D20915> into libc++ aimed=
=20
to make all members of std::array and std::reverse_iterator constexpr. I=20
came across free operator functions for std::array and wondered why they=20
aint constexpr (like ones for reverse_iterator). Then I found use of=20
std::equal inside one of them and wondered one more time, why nonmodifying=
=20
algorithms are not constexpr? Eventually I found this thread.
I would be happy to help you with the proposal (if it's still in your mind)=
=20
and proof-of-concept implementations for libc++ and libstdc++.
=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 6 =D0=B0=D0=B2=D0=B3=D1=83=D1=
=81=D1=82=D0=B0 2015 =D0=B3., 23:46:53 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=
=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Antony Polukhin=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> 2015-08-06 1:53 GMT+03:00 Nicol Bolas <jmck...@gmail.com <javascript:>>:
>
>> Even if it starts as a defect report, it's such a large change that it=
=20
>> could only be addressed fully as a proposal. The ISO C++ site has detail=
s=20
>> on formally making proposals <https://isocpp.org/std/submit-a-proposal>.
>>
>> If you want to make a formal proposal however, it will need to be more=
=20
>> complete than just "I'd like more things in the standard library to be=
=20
>> `constexpr`." You're going to have to do the work of looking at various=
=20
>> functions/types/etc and seeing which ones can and cannot be `constexpr`.=
If=20
>> you really want to impress people, you'll also implement `constexpr`=20
>> versions of them that works across compilers.
>>
>
> Thanks for the notes and hints!
>
> I've started writing the proposal.
> I've also implemented and tested on GCC 5.2 and CLANG 3.6 all the=20
> functionality that would be in the proposal:=20
> https://github.com/apolukhin/constexpr_additions=20
>
> --=20
> Best regards,
> Antony Polukhin
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/5b45c753-4008-4d7d-8295-1830d87ff496%40isocpp.or=
g.
------=_Part_3149_746959250.1465104612319
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I've just pushed a <a href=3D"http://reviews.llvm.org/=
D20915">patch</a> into libc++ aimed to make all members of std::array and s=
td::reverse_iterator constexpr. I came across free operator functions for s=
td::array and wondered why they aint constexpr (like ones for reverse_itera=
tor). Then I found use of std::equal inside one of them and wondered one mo=
re time, why nonmodifying algorithms are not constexpr? Eventually I found =
this thread.<div><br></div><div>I would be happy to help you with the propo=
sal (if it's still in your mind) and proof-of-concept implementations f=
or libc++ and libstdc++.<br><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3,=
6 =D0=B0=D0=B2=D0=B3=D1=83=D1=81=D1=82=D0=B0 2015 =D0=B3., 23:46:53 UTC+3 =
=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C An=
tony Polukhin =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote=
">2015-08-06 1:53 GMT+03:00 Nicol Bolas <span dir=3D"ltr"><<a href=3D"ja=
vascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"Q8B9IP6XEAAJ" rel=3D"=
nofollow" onmousedown=3D"this.href=3D'javascript:';return true;" on=
click=3D"this.href=3D'javascript:';return true;">jmck...@gmail.com<=
/a>></span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 =
..8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Eve=
n if it starts as a defect report, it's such a large change that it cou=
ld only be addressed fully as a proposal. The ISO C++ site has details on <=
a href=3D"https://isocpp.org/std/submit-a-proposal" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D'https://www.google.com/url?q\=
x3dhttps%3A%2F%2Fisocpp.org%2Fstd%2Fsubmit-a-proposal\x26sa\x3dD\x26sntz\x3=
d1\x26usg\x3dAFQjCNGlLyCIYYQUZNTTJdUEpCYxvwG8Ig';return true;" onclick=
=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fisocpp.o=
rg%2Fstd%2Fsubmit-a-proposal\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGlLyCI=
YYQUZNTTJdUEpCYxvwG8Ig';return true;">formally making proposals</a>.<br=
></div><br>If you want to make a formal proposal however, it will need to b=
e more complete than just "I'd like more things in the standard li=
brary to be `constexpr`." You're going to have to do the work of l=
ooking at various functions/types/etc and seeing which ones can and cannot =
be `constexpr`. If you really want to impress people, you'll also imple=
ment `constexpr` versions of them that works across compilers.</div></block=
quote><div><br></div><div>Thanks for the notes and hints!<br><br><div>I'=
;ve started writing the proposal.<br></div>I've
also implemented and tested on GCC 5.2 and CLANG 3.6 all the=20
functionality that would be in the proposal:=20
<a href=3D"https://github.com/apolukhin/constexpr_additions" target=3D"_bla=
nk" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://www.google.com=
/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fapolukhin%2Fconstexpr_additions\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGLH-pBc9D1TSC9qo7o2dvL69mnng';return =
true;" onclick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A=
%2F%2Fgithub.com%2Fapolukhin%2Fconstexpr_additions\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNGLH-pBc9D1TSC9qo7o2dvL69mnng';return true;">https://git=
hub.com/apolukhin/<wbr>constexpr_additions</a> <br></div></div><br>-- <br><=
div>Best regards,<br>Antony Polukhin</div>
</div></div>
</blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5b45c753-4008-4d7d-8295-1830d87ff496%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5b45c753-4008-4d7d-8295-1830d87ff496=
%40isocpp.org</a>.<br />
------=_Part_3149_746959250.1465104612319--
------=_Part_3148_73751127.1465104612319--
.
Author: Louis Dionne <ldionne.2@gmail.com>
Date: Tue, 7 Jun 2016 19:18:39 -0700 (PDT)
Raw View
------=_Part_771_2112897920.1465352319874
Content-Type: multipart/alternative;
boundary="----=_Part_772_2144728855.1465352319875"
------=_Part_772_2144728855.1465352319875
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
FWIW, here's the patch I had when I wrote P0107:
https://gist.github.com/ldionne/9750c497fd73713717dac3d752cf563a
Regards,
Louis
On Saturday, 4 June 2016 22:30:12 UTC-7, Anton Bikineev wrote:
>
> I've just pushed a patch <http://reviews.llvm.org/D20915> into libc++=20
> aimed to make all members of std::array and std::reverse_iterator=20
> constexpr. I came across free operator functions for std::array and=20
> wondered why they aint constexpr (like ones for reverse_iterator). Then I=
=20
> found use of std::equal inside one of them and wondered one more time, wh=
y=20
> nonmodifying algorithms are not constexpr? Eventually I found this thread=
..
>
> I would be happy to help you with the proposal (if it's still in your=20
> mind) and proof-of-concept implementations for libc++ and libstdc++.
>
> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 6 =D0=B0=D0=B2=D0=B3=D1=83=D1=
=81=D1=82=D0=B0 2015 =D0=B3., 23:46:53 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=
=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Antony Polukhin=20
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>> 2015-08-06 1:53 GMT+03:00 Nicol Bolas <jmck...@gmail.com>:
>>
>>> Even if it starts as a defect report, it's such a large change that it=
=20
>>> could only be addressed fully as a proposal. The ISO C++ site has detai=
ls=20
>>> on formally making proposals <https://isocpp.org/std/submit-a-proposal>=
..
>>>
>>> If you want to make a formal proposal however, it will need to be more=
=20
>>> complete than just "I'd like more things in the standard library to be=
=20
>>> `constexpr`." You're going to have to do the work of looking at various=
=20
>>> functions/types/etc and seeing which ones can and cannot be `constexpr`=
.. If=20
>>> you really want to impress people, you'll also implement `constexpr`=20
>>> versions of them that works across compilers.
>>>
>>
>> Thanks for the notes and hints!
>>
>> I've started writing the proposal.
>> I've also implemented and tested on GCC 5.2 and CLANG 3.6 all the=20
>> functionality that would be in the proposal:=20
>> https://github.com/apolukhin/constexpr_additions=20
>>
>> --=20
>> Best regards,
>> Antony Polukhin
>>
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/51844617-0162-4a7d-89bf-0104e54ea438%40isocpp.or=
g.
------=_Part_772_2144728855.1465352319875
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">FWIW, here's the patch I had when I wrote P0107:<div><=
br></div><div>https://gist.github.com/ldionne/9750c497fd73713717dac3d752cf5=
63a</div><div><br></div><div>Regards,</div><div>Louis<br><br>On Saturday, 4=
June 2016 22:30:12 UTC-7, Anton Bikineev wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div dir=3D"ltr">I've just pushed a <a href=3D"http:=
//reviews.llvm.org/D20915" target=3D"_blank" rel=3D"nofollow" onmousedown=
=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Freviews.ll=
vm.org%2FD20915\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFlw4Xk5EF-H_jypE6ib=
HUd6wFsKA';return true;" onclick=3D"this.href=3D'http://www.google.=
com/url?q\x3dhttp%3A%2F%2Freviews.llvm.org%2FD20915\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNFlw4Xk5EF-H_jypE6ibHUd6wFsKA';return true;">patch</a> =
into libc++ aimed to make all members of std::array and std::reverse_iterat=
or constexpr. I came across free operator functions for std::array and wond=
ered why they aint constexpr (like ones for reverse_iterator). Then I found=
use of std::equal inside one of them and wondered one more time, why nonmo=
difying algorithms are not constexpr? Eventually I found this thread.<div><=
br></div><div>I would be happy to help you with the proposal (if it's s=
till in your mind) and proof-of-concept implementations for libc++ and libs=
tdc++.<br><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 6 =D0=B0=D0=B2=D0=
=B3=D1=83=D1=81=D1=82=D0=B0 2015 =D0=B3., 23:46:53 UTC+3 =D0=BF=D0=BE=D0=BB=
=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Antony Polukhin =D0=
=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">2015-08-06 1:53 GMT+0=
3:00 Nicol Bolas <span dir=3D"ltr"><<a rel=3D"nofollow">jmck...@gmail.co=
m</a>></span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>E=
ven if it starts as a defect report, it's such a large change that it c=
ould only be addressed fully as a proposal. The ISO C++ site has details on=
<a href=3D"https://isocpp.org/std/submit-a-proposal" rel=3D"nofollow" targ=
et=3D"_blank" onmousedown=3D"this.href=3D'https://www.google.com/url?q\=
x3dhttps%3A%2F%2Fisocpp.org%2Fstd%2Fsubmit-a-proposal\x26sa\x3dD\x26sntz\x3=
d1\x26usg\x3dAFQjCNGlLyCIYYQUZNTTJdUEpCYxvwG8Ig';return true;" onclick=
=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fisocpp.o=
rg%2Fstd%2Fsubmit-a-proposal\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGlLyCI=
YYQUZNTTJdUEpCYxvwG8Ig';return true;">formally making proposals</a>.<br=
></div><br>If you want to make a formal proposal however, it will need to b=
e more complete than just "I'd like more things in the standard li=
brary to be `constexpr`." You're going to have to do the work of l=
ooking at various functions/types/etc and seeing which ones can and cannot =
be `constexpr`. If you really want to impress people, you'll also imple=
ment `constexpr` versions of them that works across compilers.</div></block=
quote><div><br></div><div>Thanks for the notes and hints!<br><br><div>I'=
;ve started writing the proposal.<br></div>I've
also implemented and tested on GCC 5.2 and CLANG 3.6 all the=20
functionality that would be in the proposal:=20
<a href=3D"https://github.com/apolukhin/constexpr_additions" rel=3D"nofollo=
w" target=3D"_blank" onmousedown=3D"this.href=3D'https://www.google.com=
/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fapolukhin%2Fconstexpr_additions\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGLH-pBc9D1TSC9qo7o2dvL69mnng';return =
true;" onclick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A=
%2F%2Fgithub.com%2Fapolukhin%2Fconstexpr_additions\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNGLH-pBc9D1TSC9qo7o2dvL69mnng';return true;">https://git=
hub.com/apolukhin/<wbr>constexpr_additions</a> <br></div></div><br>-- <br><=
div>Best regards,<br>Antony Polukhin</div>
</div></div>
</blockquote></div></div></blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/51844617-0162-4a7d-89bf-0104e54ea438%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/51844617-0162-4a7d-89bf-0104e54ea438=
%40isocpp.org</a>.<br />
------=_Part_772_2144728855.1465352319875--
------=_Part_771_2112897920.1465352319874--
.
Author: Antony Polukhin <antoshkka@gmail.com>
Date: Thu, 7 Jul 2016 09:04:58 +0300
Raw View
--94eb2c0b85d04260d90537057748
Content-Type: text/plain; charset=UTF-8
2016-06-05 8:30 GMT+03:00 <ant.bikineev@gmail.com>:
> I've just pushed a patch <http://reviews.llvm.org/D20915> into libc++
> aimed to make all members of std::array and std::reverse_iterator
> constexpr. I came across free operator functions for std::array and
> wondered why they aint constexpr (like ones for reverse_iterator). Then I
> found use of std::equal inside one of them and wondered one more time, why
> nonmodifying algorithms are not constexpr? Eventually I found this thread.
>
> I would be happy to help you with the proposal (if it's still in your
> mind) and proof-of-concept implementations for libc++ and libstdc++.
>
The proposal for constexpr std::array was already accepted into C++17.
Proposal for constexpr algorithms will be in C++Next (the one after C++17).
Now I'm working on constexpr for std::complex and on a small paper to add
more constexpr to std::array and some helper methods.
There's actually not much work remains, so I'll finish the work on my own.
Thanks for your offer to help!
--
Best regards,
Antony Polukhin
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKqmYPbgcDcgMp-_BeXP5%3DJzhG7Peqgd350VTYThfQtQJWesmw%40mail.gmail.com.
--94eb2c0b85d04260d90537057748
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">2016-06-05 8:30 GMT+03:00 <span dir=3D"ltr"><<a href=3D"mailto:ant.=
bikineev@gmail.com" target=3D"_blank">ant.bikineev@gmail.com</a>></span>=
:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I&#=
39;ve just pushed a <a href=3D"http://reviews.llvm.org/D20915" target=3D"_b=
lank">patch</a> into libc++ aimed to make all members of std::array and std=
::reverse_iterator constexpr. I came across free operator functions for std=
::array and wondered why they aint constexpr (like ones for reverse_iterato=
r). Then I found use of std::equal inside one of them and wondered one more=
time, why nonmodifying algorithms are not constexpr? Eventually I found th=
is thread.<div><br></div><div>I would be happy to help you with the proposa=
l (if it's still in your mind) and proof-of-concept implementations for=
libc++ and libstdc++.<br></div></div></blockquote><div><br></div><div>The =
proposal for constexpr std::array was already accepted into C++17.<br></div=
><div>Proposal for constexpr algorithms will be in C++Next (the one after C=
++17).<br></div><div>Now I'm working on constexpr for std::complex and =
on a small paper to add more constexpr to std::array and some helper method=
s.<br><br></div><div>There's actually not much work remains, so I'l=
l finish the work on my own. Thanks for your offer to help!<br></div><br cl=
ear=3D"all"></div><br>-- <br><div class=3D"gmail_signature" data-smartmail=
=3D"gmail_signature">Best regards,<br>Antony Polukhin</div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAKqmYPbgcDcgMp-_BeXP5%3DJzhG7Peqgd35=
0VTYThfQtQJWesmw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKqmYPbgcDcgMp=
-_BeXP5%3DJzhG7Peqgd350VTYThfQtQJWesmw%40mail.gmail.com</a>.<br />
--94eb2c0b85d04260d90537057748--
.
Author: gerard.s.stone@gmail.com
Date: Mon, 1 Aug 2016 14:54:50 -0700 (PDT)
Raw View
------=_Part_923_948629163.1470088490588
Content-Type: multipart/alternative;
boundary="----=_Part_924_1588466227.1470088490589"
------=_Part_924_1588466227.1470088490589
Content-Type: text/plain; charset=UTF-8
First of all, I wanted to thank you for writing this proposal and pushing
it into the Standard.
I think that std::destroy and std::destroy_at from C++17 should also be
marked as constexpr.
Here's why. I've been implementing my own container, which could be used in
constexpr functions, and found the following constructs very useful:
template <typename ForwardIterator>
constexpr void destroy_at(ForwardIterator position) noexcept
{
if constexpr(!std::is_trivially_destructible_v<typename std::
iterator_traits<ForwardIterator>::value_type>)
(*position).~value_type();
}
template <typename T>
constexpr void destroy(T& x) noexcept
{
if constexpr(!std::is_trivially_destructible_v<T>)
x.~T();
}
template <typename ForwardIterator>
constexpr void destroy(ForwardIterator first, ForwardIterator last) noexcept
{
if constexpr(!std::is_trivially_destructible_v<typename std::
iterator_traits<ForwardIterator>::value_type>)
{
for(; first != last; ++first)
(*first).~value_type();
}
}
So basically when value_type of iterator (or T) is trivially destructible,
everything inside "if constexpr" is discarded, and instances of these
function templates could be used in constant expressions.
On Thursday, July 7, 2016 at 9:05:00 AM UTC+3, Antony Polukhin wrote:
>
>
>
> 2016-06-05 8:30 GMT+03:00 <ant.bi...@gmail.com <javascript:>>:
>
>> I've just pushed a patch <http://reviews.llvm.org/D20915> into libc++
>> aimed to make all members of std::array and std::reverse_iterator
>> constexpr. I came across free operator functions for std::array and
>> wondered why they aint constexpr (like ones for reverse_iterator). Then I
>> found use of std::equal inside one of them and wondered one more time, why
>> nonmodifying algorithms are not constexpr? Eventually I found this thread.
>>
>> I would be happy to help you with the proposal (if it's still in your
>> mind) and proof-of-concept implementations for libc++ and libstdc++.
>>
>
> The proposal for constexpr std::array was already accepted into C++17.
> Proposal for constexpr algorithms will be in C++Next (the one after C++17).
> Now I'm working on constexpr for std::complex and on a small paper to add
> more constexpr to std::array and some helper methods.
>
> There's actually not much work remains, so I'll finish the work on my own.
> Thanks for your offer to help!
>
>
> --
> Best regards,
> Antony Polukhin
>
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40isocpp.org.
------=_Part_924_1588466227.1470088490589
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">First of all, I wanted to thank you for writing this propo=
sal and pushing it into the Standard.<br><br>I think that std::destroy and =
std::destroy_at from C++17 should also be marked as constexpr.<br>Here'=
s why. I've been implementing my own container, which could be used in =
constexpr functions, and found the following constructs very useful:<br><br=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</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">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">ForwardIterator</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: #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">void</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> destroy_at</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">ForwardIterator</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> position</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> noexcept<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>=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">if</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: #660;" class=3D"styled-by-prettify">(!</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">is_trivially_destructible</span><=
span style=3D"color: #080;" class=3D"styled-by-prettify">_v<</span><code=
class=3D"prettyprint"><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">typename</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">iterator_t=
raits</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><<=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">ForwardIter=
ator</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>::=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">value_type=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify"></span></c=
ode><span style=3D"color: #080;" class=3D"styled-by-prettify">></span><s=
pan 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>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(*</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">position</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">).~</span><span style=3D"color: #000;" class=3D"styled-by-prettify">va=
lue_type</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><br></span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</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: #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"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">constexpr</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> des=
troy</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> x</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> noexcept<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>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </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: #008;"=
class=3D"styled-by-prettify">constexpr</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_trivially_destructible</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">_v<</span><span style=3D"color: #000;" class=3D"sty=
led-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: #660;" class=3D"styled-by-prettify">)</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 x</span><span style=3D"color: #6=
60;" 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"sty=
led-by-prettify">();</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">templat=
e</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">ForwardIterator</span><span style=
=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: #=
008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> destroy</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">ForwardIterator</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> first</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: #606;" class=3D"styled-by-prettify">ForwardIt=
erator</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">last</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> noexcept<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"><br></span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 =C2=A0 =C2=A0 </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=
: #008;" class=3D"styled-by-prettify">constexpr</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"styl=
ed-by-prettify">is_trivially_destructible</span>_v<<span style=3D"color:=
#080;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">iterator_traits</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">ForwardIterator</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">>::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">value_type</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"></span></code>></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>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">for</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
first </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: #008;" class=3D"styled-by-prettify">last</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;" cl=
ass=3D"styled-by-prettify">first</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(*</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">first</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">).~</span><span style=3D"color: #000;" class=3D"styled-by-prettify">va=
lue_type</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </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></span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span></div></code></div><br>So basically when value_type of iterator (or=
T) is trivially destructible, everything inside "if constexpr" i=
s discarded, and instances of these function templates could be used in con=
stant expressions.<br><br>On Thursday, July 7, 2016 at 9:05:00 AM UTC+3, An=
tony Polukhin wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><br><div><br><div class=3D"gmail_quote">2016-06-05 8:30 GMT+03:00 =
<span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfusc=
ated-mailto=3D"XV4Ec0kHCQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#=
39;javascript:';return true;" onclick=3D"this.href=3D'javascript:&#=
39;;return true;">ant.bi...@gmail.com</a>></span>:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div dir=3D"ltr">I've just pushed a <a=
href=3D"http://reviews.llvm.org/D20915" target=3D"_blank" rel=3D"nofollow"=
onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%=
2Freviews.llvm.org%2FD20915\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFlw4Xk5=
EF-H_jypE6ibHUd6wFsKA';return true;" onclick=3D"this.href=3D'http:/=
/www.google.com/url?q\x3dhttp%3A%2F%2Freviews.llvm.org%2FD20915\x26sa\x3dD\=
x26sntz\x3d1\x26usg\x3dAFQjCNFlw4Xk5EF-H_jypE6ibHUd6wFsKA';return true;=
">patch</a> into libc++ aimed to make all members of std::array and std::re=
verse_iterator constexpr. I came across free operator functions for std::ar=
ray and wondered why they aint constexpr (like ones for reverse_iterator). =
Then I found use of std::equal inside one of them and wondered one more tim=
e, why nonmodifying algorithms are not constexpr? Eventually I found this t=
hread.<div><br></div><div>I would be happy to help you with the proposal (i=
f it's still in your mind) and proof-of-concept implementations for lib=
c++ and libstdc++.<br></div></div></blockquote><div><br></div><div>The prop=
osal for constexpr std::array was already accepted into C++17.<br></div><di=
v>Proposal for constexpr algorithms will be in C++Next (the one after C++17=
).<br></div><div>Now I'm working on constexpr for std::complex and on a=
small paper to add more constexpr to std::array and some helper methods.<b=
r><br></div><div>There's actually not much work remains, so I'll fi=
nish the work on my own. Thanks for your offer to help!<br></div><br clear=
=3D"all"></div><br>-- <br><div>Best regards,<br>Antony Polukhin</div>
</div></div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5=
%40isocpp.org</a>.<br />
------=_Part_924_1588466227.1470088490589--
------=_Part_923_948629163.1470088490588--
.
Author: Patrice Roy <patricer@gmail.com>
Date: Mon, 1 Aug 2016 21:31:57 -0400
Raw View
--001a114db2b0c3d11405390caea2
Content-Type: text/plain; charset=UTF-8
Algorithms by Brent Friedman (from SG14) that do this for ranges of objects
have been approved for C++17 in Oulu. They aren't constexpr, though
2016-08-01 17:54 GMT-04:00 <gerard.s.stone@gmail.com>:
> First of all, I wanted to thank you for writing this proposal and pushing
> it into the Standard.
>
> I think that std::destroy and std::destroy_at from C++17 should also be
> marked as constexpr.
> Here's why. I've been implementing my own container, which could be used
> in constexpr functions, and found the following constructs very useful:
>
> template <typename ForwardIterator>
> constexpr void destroy_at(ForwardIterator position) noexcept
> {
> if constexpr(!std::is_trivially_destructible_v<typename std::
> iterator_traits<ForwardIterator>::value_type>)
> (*position).~value_type();
> }
>
> template <typename T>
> constexpr void destroy(T& x) noexcept
> {
> if constexpr(!std::is_trivially_destructible_v<T>)
> x.~T();
> }
>
> template <typename ForwardIterator>
> constexpr void destroy(ForwardIterator first, ForwardIterator last)
> noexcept
> {
> if constexpr(!std::is_trivially_destructible_v<typename std::
> iterator_traits<ForwardIterator>::value_type>)
> {
> for(; first != last; ++first)
> (*first).~value_type();
> }
> }
>
> So basically when value_type of iterator (or T) is trivially destructible,
> everything inside "if constexpr" is discarded, and instances of these
> function templates could be used in constant expressions.
>
> On Thursday, July 7, 2016 at 9:05:00 AM UTC+3, Antony Polukhin wrote:
>>
>>
>>
>> 2016-06-05 8:30 GMT+03:00 <ant.bi...@gmail.com>:
>>
>>> I've just pushed a patch <http://reviews.llvm.org/D20915> into libc++
>>> aimed to make all members of std::array and std::reverse_iterator
>>> constexpr. I came across free operator functions for std::array and
>>> wondered why they aint constexpr (like ones for reverse_iterator). Then I
>>> found use of std::equal inside one of them and wondered one more time, why
>>> nonmodifying algorithms are not constexpr? Eventually I found this thread.
>>>
>>> I would be happy to help you with the proposal (if it's still in your
>>> mind) and proof-of-concept implementations for libc++ and libstdc++.
>>>
>>
>> The proposal for constexpr std::array was already accepted into C++17.
>> Proposal for constexpr algorithms will be in C++Next (the one after
>> C++17).
>> Now I'm working on constexpr for std::complex and on a small paper to add
>> more constexpr to std::array and some helper methods.
>>
>> There's actually not much work remains, so I'll finish the work on my
>> own. Thanks for your offer to help!
>>
>>
>> --
>> Best regards,
>> Antony Polukhin
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKiZDp2tT25Fu_dHE6_P_S95wZcKekcnq9muhqSc%2B2%3DGoaGc7Q%40mail.gmail.com.
--001a114db2b0c3d11405390caea2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Algorithms by Brent Friedman (from SG14) that do this for =
ranges of objects have been approved for C++17 in Oulu. They aren't con=
stexpr, though<br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_=
quote">2016-08-01 17:54 GMT-04:00 <span dir=3D"ltr"><<a href=3D"mailto:=
gerard.s.stone@gmail.com" target=3D"_blank">gerard.s.stone@gmail.com</a>>=
;</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">First of all, =
I wanted to thank you for writing this proposal and pushing it into the Sta=
ndard.<br><br>I think that std::destroy and std::destroy_at from C++17 shou=
ld also be marked as constexpr.<br>Here's why. I've been implementi=
ng my own container, which could be used in constexpr functions, and found =
the following constructs very useful:<br><br><div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">templa=
te</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
</span><span style=3D"color:#008">typename</span><span style=3D"color:#000"=
> </span><span style=3D"color:#606">ForwardIterator</span><span style=3D"co=
lor:#660">></span><span style=3D"color:#000"><br></span><span style=3D"c=
olor:#008">constexpr</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">void</span><span style=3D"color:#000"> destroy_at</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#606">ForwardIterator<=
/span><span style=3D"color:#000"> position</span><span style=3D"color:#660"=
>)</span><span style=3D"color:#000"> noexcept<br></span><span style=3D"colo=
r:#660">{</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">if</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#008">constexpr</=
span><span style=3D"color:#660">(!</span><span style=3D"color:#000">std</sp=
an><span style=3D"color:#660">::</span><span style=3D"color:#000">is_trivia=
lly_destructible</span><span style=3D"color:#080">_v<</span><code><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">iterator_trai=
ts</span><span style=3D"color:#660"><</span><span style=3D"color:#606">F=
orwardIterator</span><span style=3D"color:#660">>::</span><span style=3D=
"color:#000">value_type</span><span style=3D"color:#660"></span></code><spa=
n style=3D"color:#080">></span><span style=3D"color:#000"></span><span s=
tyle=3D"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660"=
>(*</span><span style=3D"color:#000">position</span><span style=3D"color:#6=
60">).~</span><span style=3D"color:#000">value_type</span><span style=3D"co=
lor:#660">();</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#660">}</span><span style=3D"color:#000"><br><br></span><span style=3D"=
color:#008">template</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660"><</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> T</span><span style=3D"color:#660">></span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#008">constexpr</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">void</span><sp=
an style=3D"color:#000"> destroy</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">T</span><span style=3D"color:#660">&</span><s=
pan style=3D"color:#000"> x</span><span style=3D"color:#660">)</span><span =
style=3D"color:#000"> noexcept<br></span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span st=
yle=3D"color:#008">if</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">constexpr</span><span style=3D"color:#660">(!</span><span s=
tyle=3D"color:#000">std</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">is_trivially_destructible</span><span style=3D"color:#660=
">_v<</span><span style=3D"color:#000">T</span><span style=3D"color:#660=
">></span><span style=3D"color:#000"></span><span style=3D"color:#660">)=
</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 x</span><span style=3D"color:#660">.~</span><span styl=
e=3D"color:#000">T</span><span style=3D"color:#660">();</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#008">template</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#660"><</span><spa=
n style=3D"color:#008">typename</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#606">ForwardIterator</span><span style=3D"color:#660">&=
gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">=
constexpr</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">void</span><span style=3D"color:#000"> destroy</span><span style=3D"colo=
r:#660">(</span><span style=3D"color:#606">ForwardIterator</span><span styl=
e=3D"color:#000"> first</span><span style=3D"color:#660">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">ForwardIterator</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">last</span><sp=
an style=3D"color:#660">)</span><span style=3D"color:#000"> noexcept<br></s=
pan><span style=3D"color:#660">{</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=
=3D"color:#008">if</span><span style=3D"color:#000"> </span><span style=3D"=
color:#008">constexpr</span><span style=3D"color:#660">(!</span><span style=
=3D"color:#000">std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">is_trivially_destructible</span>_v<<span style=3D"color:=
#080"><code><span style=3D"color:#008">typename</span><span style=3D"color:=
#000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#=
000">iterator_traits</span><span style=3D"color:#660"><</span><span styl=
e=3D"color:#606">ForwardIterator</span><span style=3D"color:#660">>::</s=
pan><span style=3D"color:#000">value_type</span><span style=3D"color:#660">=
</span></code>></span><span style=3D"color:#000"></span><span style=3D"c=
olor:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">for</span><span style=3D"color:#660">(;</span><span style=
=3D"color:#000"> first </span><span style=3D"color:#660">!=3D</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">last</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">++</span><span style=3D"color:#000">first</span><span style=3D=
"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span=
style=3D"color:#660">(*</span><span style=3D"color:#000">first</span><span=
style=3D"color:#660">).~</span><span style=3D"color:#000">value_type</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0=
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">}</span></div></code>=
</div><br>So basically when value_type of iterator (or T) is trivially dest=
ructible, everything inside "if constexpr" is discarded, and inst=
ances of these function templates could be used in constant expressions.<br=
><br>On Thursday, July 7, 2016 at 9:05:00 AM UTC+3, Antony Polukhin wrote:<=
span class=3D""><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"><b=
r><div><br><div class=3D"gmail_quote">2016-06-05 8:30 GMT+03:00 <span dir=
=3D"ltr"><<a rel=3D"nofollow">ant.bi...@gmail.com</a>></span>:<br><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I've ju=
st pushed a <a href=3D"http://reviews.llvm.org/D20915" rel=3D"nofollow" tar=
get=3D"_blank">patch</a> into libc++ aimed to make all members of std::arra=
y and std::reverse_iterator constexpr. I came across free operator function=
s for std::array and wondered why they aint constexpr (like ones for revers=
e_iterator). Then I found use of std::equal inside one of them and wondered=
one more time, why nonmodifying algorithms are not constexpr? Eventually I=
found this thread.<div><br></div><div>I would be happy to help you with th=
e proposal (if it's still in your mind) and proof-of-concept implementa=
tions for libc++ and libstdc++.<br></div></div></blockquote><div><br></div>=
<div>The proposal for constexpr std::array was already accepted into C++17.=
<br></div><div>Proposal for constexpr algorithms will be in C++Next (the on=
e after C++17).<br></div><div>Now I'm working on constexpr for std::com=
plex and on a small paper to add more constexpr to std::array and some help=
er methods.<br><br></div><div>There's actually not much work remains, s=
o I'll finish the work on my own. Thanks for your offer to help!<br></d=
iv><br clear=3D"all"></div><br>-- <br><div>Best regards,<br>Antony Polukhin=
</div>
</div></div>
</blockquote></span></div><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-=
4b70-a9bf-d91f575065e5%40isocpp.org</a>.<br>
</blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAKiZDp2tT25Fu_dHE6_P_S95wZcKekcnq9mu=
hqSc%2B2%3DGoaGc7Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKiZDp2tT25F=
u_dHE6_P_S95wZcKekcnq9muhqSc%2B2%3DGoaGc7Q%40mail.gmail.com</a>.<br />
--001a114db2b0c3d11405390caea2--
.
Author: gerard.s.stone@gmail.com
Date: Tue, 2 Aug 2016 05:24:25 -0700 (PDT)
Raw View
------=_Part_2748_1813344812.1470140665482
Content-Type: multipart/alternative;
boundary="----=_Part_2749_118839668.1470140665483"
------=_Part_2749_118839668.1470140665483
Content-Type: text/plain; charset=UTF-8
Yeah, I've read p0040
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html> and
I really like this addition.
What I'm trying to say is that std::destroy(_at|_n) should be marked as
constexpr, because then it will be a guaranteed no-op for objects with
trivial destructors and also make it easier to write generic code.
Maybe I should submit a library issue? Or write a proposal? I'm asking
because I want to help out!
On Tuesday, August 2, 2016 at 4:31:59 AM UTC+3, Patrice Roy wrote:
>
> Algorithms by Brent Friedman (from SG14) that do this for ranges of
> objects have been approved for C++17 in Oulu. They aren't constexpr, though
>
> 2016-08-01 17:54 GMT-04:00 <gerard....@gmail.com <javascript:>>:
>
>> First of all, I wanted to thank you for writing this proposal and pushing
>> it into the Standard.
>>
>> I think that std::destroy and std::destroy_at from C++17 should also be
>> marked as constexpr.
>> Here's why. I've been implementing my own container, which could be used
>> in constexpr functions, and found the following constructs very useful:
>>
>> template <typename ForwardIterator>
>> constexpr void destroy_at(ForwardIterator position) noexcept
>> {
>> if constexpr(!std::is_trivially_destructible_v<typename std::
>> iterator_traits<ForwardIterator>::value_type>)
>> (*position).~value_type();
>> }
>>
>> template <typename T>
>> constexpr void destroy(T& x) noexcept
>> {
>> if constexpr(!std::is_trivially_destructible_v<T>)
>> x.~T();
>> }
>>
>> template <typename ForwardIterator>
>> constexpr void destroy(ForwardIterator first, ForwardIterator last)
>> noexcept
>> {
>> if constexpr(!std::is_trivially_destructible_v<typename std::
>> iterator_traits<ForwardIterator>::value_type>)
>> {
>> for(; first != last; ++first)
>> (*first).~value_type();
>> }
>> }
>>
>> So basically when value_type of iterator (or T) is trivially
>> destructible, everything inside "if constexpr" is discarded, and instances
>> of these function templates could be used in constant expressions.
>>
>> On Thursday, July 7, 2016 at 9:05:00 AM UTC+3, Antony Polukhin wrote:
>>>
>>>
>>>
>>> 2016-06-05 8:30 GMT+03:00 <ant.bi...@gmail.com>:
>>>
>>>> I've just pushed a patch <http://reviews.llvm.org/D20915> into libc++
>>>> aimed to make all members of std::array and std::reverse_iterator
>>>> constexpr. I came across free operator functions for std::array and
>>>> wondered why they aint constexpr (like ones for reverse_iterator). Then I
>>>> found use of std::equal inside one of them and wondered one more time, why
>>>> nonmodifying algorithms are not constexpr? Eventually I found this thread.
>>>>
>>>> I would be happy to help you with the proposal (if it's still in your
>>>> mind) and proof-of-concept implementations for libc++ and libstdc++.
>>>>
>>>
>>> The proposal for constexpr std::array was already accepted into C++17.
>>> Proposal for constexpr algorithms will be in C++Next (the one after
>>> C++17).
>>> Now I'm working on constexpr for std::complex and on a small paper to
>>> add more constexpr to std::array and some helper methods.
>>>
>>> There's actually not much work remains, so I'll finish the work on my
>>> own. Thanks for your offer to help!
>>>
>>>
>>> --
>>> Best regards,
>>> Antony Polukhin
>>>
>> --
>> 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-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>
>
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/62d94720-8c53-4bd9-9779-28de909f135d%40isocpp.org.
------=_Part_2749_118839668.1470140665483
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Yeah, I've read <a href=3D"http://www.open-std.org/jtc=
1/sc22/wg21/docs/papers/2016/p0040r2.html">p0040</a> and I really like this=
addition.<br>What I'm trying to say is that std::destroy(_at|_n) shoul=
d be marked as constexpr, because then it will be a guaranteed no-op for ob=
jects with trivial destructors and also make it easier to write generic cod=
e.<br>Maybe I should submit a library issue? Or write a proposal? I'm a=
sking because I want to help out!<br><br>On Tuesday, August 2, 2016 at 4:31=
:59 AM UTC+3, Patrice Roy wrote:<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">Algorithms by Brent Friedman (from SG14) that do this fo=
r ranges of objects have been approved for C++17 in Oulu. They aren't c=
onstexpr, though<br></div><div><br><div class=3D"gmail_quote">2016-08-01 17=
:54 GMT-04:00 <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"KQFJxfDQBgAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">gerard....@gmail.com</a>></span>:<br><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex"><div dir=3D"ltr">First of all, I wanted to than=
k you for writing this proposal and pushing it into the Standard.<br><br>I =
think that std::destroy and std::destroy_at from C++17 should also be marke=
d as constexpr.<br>Here's why. I've been implementing my own contai=
ner, which could be used in constexpr functions, and found the following co=
nstructs very useful:<br><br><div style=3D"background-color:rgb(250,250,250=
);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wr=
ap:break-word"><code><div><span style=3D"color:#008">template</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660"><</span><span sty=
le=3D"color:#008">typename</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#606">ForwardIterator</span><span style=3D"color:#660">></=
span><span style=3D"color:#000"><br></span><span style=3D"color:#008">const=
expr</span><span style=3D"color:#000"> </span><span style=3D"color:#008">vo=
id</span><span style=3D"color:#000"> destroy_at</span><span style=3D"color:=
#660">(</span><span style=3D"color:#606">ForwardIterator</span><span style=
=3D"color:#000"> position</span><span style=3D"color:#660">)</span><span st=
yle=3D"color:#000"> noexcept<br></span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"><br></span><span style=3D"color:#000">=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">if</span><span style=3D=
"color:#000"> </span><span style=3D"color:#008">constexpr</span><span style=
=3D"color:#660">(!</span><span style=3D"color:#000">std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">is_trivially_<wbr>destr=
uctible</span><span style=3D"color:#080">_v<</span><code><span style=3D"=
color:#008">typename</span><span style=3D"color:#000"> std</span><span styl=
e=3D"color:#660">::</span><span style=3D"color:#000">iterator_traits</span>=
<span style=3D"color:#660"><</span><span style=3D"color:#606">ForwardIt<=
wbr>erator</span><span style=3D"color:#660">>::</span><span style=3D"col=
or:#000">value_type</span><span style=3D"color:#660"></span></code><span st=
yle=3D"color:#080">></span><span style=3D"color:#000"></span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">(*</s=
pan><span style=3D"color:#000">position</span><span style=3D"color:#660">).=
~</span><span style=3D"color:#000">value_type</span><span style=3D"color:#6=
60">();</span><span style=3D"color:#000"><br></span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br><br></span><span style=3D"color:=
#008">template</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660"><</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"><br></span><span style=3D"color:#008">constexpr</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> destroy</span><span style=3D"color:#660">(</span><span sty=
le=3D"color:#000">T</span><span style=3D"color:#660">&</span><span styl=
e=3D"color:#000"> x</span><span style=3D"color:#660">)</span><span style=3D=
"color:#000"> noexcept<br></span><span style=3D"color:#660">{</span><span s=
tyle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"c=
olor:#008">if</span><span style=3D"color:#000"> </span><span style=3D"color=
:#008">constexpr</span><span style=3D"color:#660">(!</span><span style=3D"c=
olor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#000">is_trivially_<wbr>destructible</span><span style=3D"color:#660">_v=
<</span><span style=3D"color:#000">T</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"></span><span style=3D"color:#660">)</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 x</span><span style=3D"color:#660">.~</span><span style=3D"c=
olor:#000">T</span><span style=3D"color:#660">();</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#660">}</span><span style=3D"color:=
#000"><br><br></span><span style=3D"color:#008">template</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660"><</span><span style=
=3D"color:#008">typename</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#606">ForwardIterator</span><span style=3D"color:#660">></sp=
an><span style=3D"color:#000"><br></span><span style=3D"color:#008">constex=
pr</span><span style=3D"color:#000"> </span><span style=3D"color:#008">void=
</span><span style=3D"color:#000"> destroy</span><span style=3D"color:#660"=
>(</span><span style=3D"color:#606">ForwardIterator</span><span style=3D"co=
lor:#000"> first</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#606">ForwardIterator</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#008">last</span><span styl=
e=3D"color:#660">)</span><span style=3D"color:#000"> noexcept<br></span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"><br></span><span=
style=3D"color:#000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"col=
or:#008">if</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">constexpr</span><span style=3D"color:#660">(!</span><span style=3D"col=
or:#000">std</span><span style=3D"color:#660">::</span><span style=3D"color=
:#000">is_trivially_<wbr>destructible</span>_v<<span style=3D"color:#080=
"><code><span style=3D"color:#008">typename</span><span style=3D"color:#000=
"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#000"=
>iterator_traits</span><span style=3D"color:#660"><</span><span style=3D=
"color:#606">ForwardIt<wbr>erator</span><span style=3D"color:#660">>::</=
span><span style=3D"color:#000">value_type</span><span style=3D"color:#660"=
></span></code>></span><span style=3D"color:#000"></span><span style=3D"=
color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">for</span><span style=3D"color:#660">(;</span><span style=
=3D"color:#000"> first </span><span style=3D"color:#660">!=3D</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">last</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">++</span><span style=3D"color:#000">first</span><span style=3D=
"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span=
style=3D"color:#660">(*</span><span style=3D"color:#000">first</span><span=
style=3D"color:#660">).~</span><span style=3D"color:#000">value_type</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>=C2=A0=
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">}</span></div></code>=
</div><br>So basically when value_type of iterator (or T) is trivially dest=
ructible, everything inside "if constexpr" is discarded, and inst=
ances of these function templates could be used in constant expressions.<br=
><br>On Thursday, July 7, 2016 at 9:05:00 AM UTC+3, Antony Polukhin wrote:<=
span><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"><br><div><br>=
<div class=3D"gmail_quote">2016-06-05 8:30 GMT+03:00 <span dir=3D"ltr"><=
;<a rel=3D"nofollow">ant.bi...@gmail.com</a>></span>:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I've just pushed a =
<a href=3D"http://reviews.llvm.org/D20915" rel=3D"nofollow" target=3D"_blan=
k" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2=
F%2Freviews.llvm.org%2FD20915\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFlw4X=
k5EF-H_jypE6ibHUd6wFsKA';return true;" onclick=3D"this.href=3D'http=
://www.google.com/url?q\x3dhttp%3A%2F%2Freviews.llvm.org%2FD20915\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNFlw4Xk5EF-H_jypE6ibHUd6wFsKA';return tru=
e;">patch</a> into libc++ aimed to make all members of std::array and std::=
reverse_iterator constexpr. I came across free operator functions for std::=
array and wondered why they aint constexpr (like ones for reverse_iterator)=
.. Then I found use of std::equal inside one of them and wondered one more t=
ime, why nonmodifying algorithms are not constexpr? Eventually I found this=
thread.<div><br></div><div>I would be happy to help you with the proposal =
(if it's still in your mind) and proof-of-concept implementations for l=
ibc++ and libstdc++.<br></div></div></blockquote><div><br></div><div>The pr=
oposal for constexpr std::array was already accepted into C++17.<br></div><=
div>Proposal for constexpr algorithms will be in C++Next (the one after C++=
17).<br></div><div>Now I'm working on constexpr for std::complex and on=
a small paper to add more constexpr to std::array and some helper methods.=
<br><br></div><div>There's actually not much work remains, so I'll =
finish the work on my own. Thanks for your offer to help!<br></div><br clea=
r=3D"all"></div><br>-- <br><div>Best regards,<br>Antony Polukhin</div>
</div></div>
</blockquote></span></div><span>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
KQFJxfDQBgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:&=
#39;;return true;" onclick=3D"this.href=3D'javascript:';return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"KQFJxfDQBgAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">std-pr...@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D'https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter';return true;" on=
click=3D"this.href=3D'https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/ba1fd666-8710-4b70-a9bf-d91f575065e5%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter';return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/ba1fd666-8710-4b70-<wbr>a9bf-=
d91f575065e5%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/62d94720-8c53-4bd9-9779-28de909f135d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/62d94720-8c53-4bd9-9779-28de909f135d=
%40isocpp.org</a>.<br />
------=_Part_2749_118839668.1470140665483--
------=_Part_2748_1813344812.1470140665482--
.
Author: gerard.s.stone@gmail.com
Date: Tue, 2 Aug 2016 05:32:47 -0700 (PDT)
Raw View
------=_Part_49_320284905.1470141167751
Content-Type: multipart/alternative;
boundary="----=_Part_50_211122101.1470141167751"
------=_Part_50_211122101.1470141167751
Content-Type: text/plain; charset=UTF-8
Yeah, I've read p0040
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html> and
I really like this addition.
What I'm trying to say is that std::destroy(_at|_n) should be marked as
constexpr, because then it will be a guaranteed no-op for objects with
trivial destructors and also make it easier to write generic code. Maybe I
should submit a library issue? Or write a proposal? I'm asking because I
want to help out!
On Tuesday, August 2, 2016 at 4:31:59 AM UTC+3, Patrice Roy wrote:
>
> Algorithms by Brent Friedman (from SG14) that do this for ranges of
> objects have been approved for C++17 in Oulu. They aren't constexpr, though
>
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fdc43e6f-8fbd-428b-9863-938d6a8dbe35%40isocpp.org.
------=_Part_50_211122101.1470141167751
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Yeah, I've read <a href=3D"http://www.open-std.org/jtc=
1/sc22/wg21/docs/papers/2016/p0040r2.html" target=3D"_blank" rel=3D"nofollo=
w">p0040</a> and I really like this addition.<br>What
I'm trying to say is that std::destroy(_at|_n) should be marked as=20
constexpr, because then it will be a guaranteed no-op for objects with=20
trivial destructors and also make it easier to write generic code. Maybe I =
should submit a library issue? Or write a proposal? I'm asking because =
I want to help out!<br><br>On Tuesday, August 2, 2016 at 4:31:59 AM UTC+3, =
Patrice Roy wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">Algorithms by Brent Friedman (from SG14) that do this for ranges of ob=
jects have been approved for C++17 in Oulu. They aren't constexpr, thou=
gh<br></div></blockquote><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fdc43e6f-8fbd-428b-9863-938d6a8dbe35%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fdc43e6f-8fbd-428b-9863-938d6a8dbe35=
%40isocpp.org</a>.<br />
------=_Part_50_211122101.1470141167751--
------=_Part_49_320284905.1470141167751--
.