Greetings,

With a struct, there are many overload possibilities available.

However, I haven't been able to find how to overload assignment
of **selected fields** of a struct.

For example, suppose:

    struct Foo{
      int a;
      int b;
      ...
    }

    void main(){
        auto x = Foo( 1, 2);  // so x now instantiates

x.a = 100; // suppose I wish to enforce that a<5??
    ...
    }


(I understand this is basically a field "setter" idea that is most
often associated with classes. So, another way to state the quesion might be: "How can a field setter be done on a **already instantiated**
struct?)

Best Regards,
James


Reply via email to