say I have

```
 struct S {
    double A;
    double B;
    double C;
  };

```

and 

```
   std::vector<S> vecS(10);

```

I am trying to write a generic function `void F(std::vector<S> vecS,structure S.x)` such that the following computation can happen

```
 F(std::vector<S> vecS, structure S.x) {
        for(i=1;i<10;i++)
          vecS[0].x += vecS[i].x;  
       // note the structure does not have memeber "x"
       // I want to give that as a generic input to access A,B or C
  }

```

The above code is not correct code, but I am just trying to demonstrate what I am trying to compute. 

What I am trying to compute is loop over the vector of structs for a specific element. Is this possible in a simple nice way? Can someone please give me some pointers how to access a member of a structure in a generic way (maybe that is what I need to write this function). 

Thanks in advance.