From the code below being compiled in CodeBlocks I'm getting errors of the this type:
 no matching function for call to 'student::student(student)' candidates are:
 student::student(student&)
     no known conversion for argument 1 from 'student' to 'student&'
 student::student(std::string, int, double, float)
     candidate expects 4 arguments, 1 provided
I'm guessing that somehow the C++ compiler is implementing the copy constructor in the array definition. But I can't seem to find a way around it. I need both constructors in my program and I need to initialize the array elements through a constructor. Please provide a solution that will work on C++11.
#include <iostream>
#include <string>
using namespace std;
class student{
    string name;
    int rollno;
    double marks;
    float per;
    /// Constructors
    student(string n, int r, double m, float p){
        name = n;
        rollno = r;
        marks = m;
        per = p;
    }
    student(student& s){
        name = s.name;
        rollno = s.rollno;
        marks = s.marks;
        per = s.per;
    }
};
int main(){
    student arrays[] = { student("Anas Ayubi", 80, 980, 980/1100),
                    student("Zainab Ashraf", 78, 990, 990/1100 ),
                    student("Wali Ahmed", 28, 890, 890/1100) };
}
 
     
     
    