#include <iostream>
class test
{
public:
constexpr void setX(int val);
private:
int x;
};
constexpr void test::setX(int val)
{
x = val;
std::cout << "x : " << x << '\n';
}
int main()
{
test obj;
obj.setX(5);
return 0;
}
Here the question is, I am not able to perform I/O operations for degubbing in this constexpr function. So is there any way to do I/O opeartions inside the constexpr function or is this is a limitation/behaviour in C++?
Aucun commentaire:
Enregistrer un commentaire