adjust / parquet_fdw

Parquet foreign data wrapper for PostgreSQL
PostgreSQL License
333 stars 37 forks source link

Remove std::move to support copy elision #67

Open mkindahl opened 1 year ago

mkindahl commented 1 year ago

According to the standard, copy elision is allowed (before C++17) or required (since C++17) in the following situation:

In the initialization of an object, when the source object is a nameless temporary and is of the same class type (ignoring cv-qualification) as the target object. When the nameless temporary is the operand of a return statement, this variant of copy elision is known as RVO, "return value optimization".

Unfortunately, using std::move() will block this optimization when initializing an object, so it should not be used. Removing it allows the target object to be constructed in-place rather than being copied using the copy constructor.