What is the purpose of marking the set function (setter) as constexpr? : <p>I cannot understand the purpose of marking the setter function as <code>constexpr</code>, that is allowed since C++14.
My misunderstanding comes from the next situation:
    I declare a class with a constexpr c-tor, and I am about to use it in a constexpr context, by creating a constexpr instance of that class <code>constexpr Point p1</code>. An object <code>p1</code> now is constant and its value could not be changed, so the <code>constexpr</code> setter could not be called.
    On the other hand, when I create an instance of my <code>class Point</code> in a non-constexpr context <code>Point p</code>, I can call the setter for that object, but now setter will not execute at compile-time, because the object is not constexpr!</p>

<p>As a result, I do not understand how can I enhance the performance of my code using <code>constexpr</code> for setters.</p>

<p>This is the code that demonstrates calling a constexpr setter on an non-constexpr object, that means run-time computation, instead of the compile-time:</p>

<pre><code>class Point {
public:
    constexpr Point(int a, int b)
    : x(a), y(b) {}

    constexpr int getX() const noexcept { return x; }
    constexpr int getY() const noexcept { return y; }

    constexpr void setX(int newX) noexcept { x = newX; }
    constexpr void setY(int newY) noexcept { y = newY; }
private:
    int x;
    int y;
};


int main() {
    Point p{4, 2};
    constexpr Point p1{4, 2};

    p.setX(2);
}
</code></pre>

<p>Could anyone help me to understand what is the purpose of marking the setter function as <code>constexpr</code>?</p>
