Q:

How do I compare multiple vector of structs for similar names efficiently?

I am writing a program for my wife to help us try to decide which medical schools that she should apply for. However, I have run into a problem where I am trying to extract schools that show up in the top 20 results in 4 different cases. 
For example, in one of those cases I take the median income of the city, and divide it by the average house price in the city. That returns a double, and then I create a new vector and then sort that vector based on that number from highest to lowest. And I do similar actions to the 3 other vectors in my pool with different cases applied. 
I know I can just brute force this and extract the names with nested for loops, but I am curious to know if there is a way to do it quickly and efficiently. This is my attempt so far. (Note, this is just an example, my actual code has 30 schools in it).
#include <algorithm>
#include <iterator>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

struct Schools
{
    Schools(std::string n = "", double h = 0.0, double t = 0.0, int r = 0, int w = 0) : name(n), housing(h), tuition(t), rank(r), weight(w){};
    std::string name;
    double housing;
    double tuition;
    int rank;
    int weight;
};

void load(std::vector<std::shared_ptr<Schools>> &v, std::string n, double h, double t, int r, int w)
{
    auto newSchool = std::make_shared<Schools>(n,h,t,r,w);
    v.emplace_back(newSchool);
}

void init(std::vector<std::shared_ptr<Schools>> &schools)
{
    load(schools,"School1",40.3,20.0,3,6);
    load(schools,"School2",10.3,10.4,5,1);
    load(schools,"School3",33.3,23.5,1,2);
    load(schools,"School4",8.5,15.5,4,8);
}

auto findIntersection(auto &a, auto &b)
{
    std::vector<std::shared_ptr<Schools>> in;
    std::set_intersection(begin(a),end(a),begin(b),end(b),std::back_inserter(in));
    return in;
}

auto findCommon(auto &housing, auto &tuition, auto &rank, auto &weight)
{
    std::vector<std::shared_ptr<Schools>> inCommon;
    inCommon = findIntersection(housing,tuition);
    inCommon = findIntersection(inCommon,rank);
    inCommon = findIntersection(inCommon,weight);
    return inCommon;
}

bool compareHM(const std::shared_ptr<Schools> &a, const std::shared_ptr<Schools> &b)
{
    return a->housing < b->housing;
}

bool compareT(const std::shared_ptr<Schools> &a, const std::shared_ptr<Schools> &b)
{
    return a->tuition < b->tuition;
}

bool compareRank(const std::shared_ptr<Schools> &a, const std::shared_ptr<Schools> &b)
{
    return a->rank > b->rank;
}

bool compareWeight(const std::shared_ptr<Schools> &a, const std::shared_ptr<Schools> &b)
{
    return a->weight > b->weight;
}

int main()
{
    std::vector<std::shared_ptr<Schools>> schools;
    init(schools);
    std::vector<std::shared_ptr<Schools>> sortByHousing = schools;
    std::vector<std::shared_ptr<Schools>> sortByTuition = schools;
    std::vector<std::shared_ptr<Schools>> sortByRank = schools;
    std::vector<std::shared_ptr<Schools>> sortByWeight = schools;

    std::sort(begin(sortByHousing),end(sortByHousing), compareHM);
    std::sort(begin(sortByTuition),end(sortByTuition), compareT);
    std::sort(begin(sortByRank),end(sortByRank), compareRank);
    std::sort(begin(sortByWeight),end(sortByWeight), compareWeight);

    std::vector<std::shared_ptr<Schools>> commonSchools = findCommon(sortByHousing,sortByTuition,sortByRank,sortByWeight);

    for (auto && e: commonSchools)
    {
        std::cout << e->name << std::endl;
    }
}

I run into a problem when I try to use std::set_intersection, and then I quickly realized that I cannot do something like begin(a)->name. Again, I am trying to extract common names that show up in each of the 4 cases that I have. How do I go about implementing this? Is my idea of std::set_intersection not too far off? 
Thanks! 
EDIT:
This is an example of one of my functionThatCompares
bool compareTuition(const std::shared_ptr<Schools> &a, const std::shared_ptr<Schools> &b)
{
    return a->tuition < b->tuition;
}

EDIT 2: Example Output
The top 20 sorted by Median/House are:
Name of Institution                               Median/House Price  Tuition Over 8 Years     Has Space Industry? Score

University of Alabama                             0.463577            0.722279                 1                   0.641825
University of Maryland                            0.38124             0.722617                 1                   0.527583
Johns Hopkins Univerty School of Medicine         0.38124             0.606103                 1                   0.629002
Indiana University                                0.335939            0.501944                 0                   0.669276
Ohio State University                             0.32499             0.610704                 1                   0.532156
Perelman School of Medicine                       0.26908             0.653143                 1                   0.411977
Duke University School of Medicine                0.246991            0.66683                  1                   0.370395
University of Wisconsin                           0.226581            0.64686                  0                   0.350278
Chicago Medical School                            0.221883            0.648157                 0                   0.342329
Northwestern University                           0.221883            0.677341                 0                   0.32758
Case Western Reserve                              0.211817            0.536384                 1                   0.394898
Emory University                                  0.206169            0.576814                 1                   0.357427
Geisel School of Medicine                         0.205529            0.71526                  0                   0.287349
University of Massachusetts                       0.19562             0.64686                  1                   0.302414
Medical University of SC                          0.185816            0.354728                 0                   0.523827
University of North Carolina                      0.176684            0.6637                   0                   0.26621
University of Michigan Medical School             0.158465            0.637237                 1                   0.248675
Rutgers New Jersey Medical School                 0.140412            0.722115                 0                   0.194446
University of Utah                                0.140142            0.311285                 0                   0.450205
Georgetown University                             0.128883            0.604001                 1                   0.213382

The top 20 sorted by Tuition are:
Name of Institution                               Median/House Price  Tuition Over 8 Years     Has Space Industry? Score

University of Utah                                0.140142            0.311285                 0                   0.450205
Medical University of SC                          0.185816            0.354728                 0                   0.523827
University of California, LA                      0.07633             0.47547                  1                   0.160536
Indiana University                                0.335939            0.501944                 0                   0.669276
University of California, SD                      0.109214            0.531397                 1                   0.205523
Case Western Reserve                              0.211817            0.536384                 1                   0.394898
Emory University                                  0.206169            0.576814                 1                   0.357427
Icahn School of Medicine                          0.0822029           0.585946                 1                   0.140291
Georgetown University                             0.128883            0.604001                 1                   0.213382
Johns Hopkins Univerty School of Medicine         0.38124             0.606103                 1                   0.629002
Ohio State University                             0.32499             0.610704                 1                   0.532156
University of Virgina School of Medicine          0.123755            0.630067                 1                   0.196415
University of Michigan Medical School             0.158465            0.637237                 1                   0.248675
NY University School of Medicine                  0.0822029           0.642516                 1                   0.127939
Tufts University School of Medicine               0.100302            0.644314                 1                   0.155672
University of Massachusetts                       0.19562             0.64686                  1                   0.302414
University of Wisconsin                           0.226581            0.64686                  0                   0.350278
Chicago Medical School                            0.221883            0.648157                 0                   0.342329
Perelman School of Medicine                       0.26908             0.653143                 1                   0.411977
Standford University School of Medicine           0.0780054           0.656658                 1                   0.118791

The top 20 sorted by Median/House and Loweset Tution are:
Name of Institution                               Median/House Price  Tuition Over 8 Years     Has Space Industry? Score

University of Maryland                            0.38124             0.722617                 1                   0.527583
Chicago Medical School                            0.221883            0.648157                 0                   0.342329
University Of Washington                          0.0973689           0.761413                 1                   0.127879
University of Alabama                             0.463577            0.722279                 1                   0.641825
Rutgers New Jersey Medical School                 0.140412            0.722115                 0                   0.194446
Geisel School of Medicine                         0.205529            0.71526                  0                   0.287349
Ohio State University                             0.32499             0.610704                 1                   0.532156
Harvard Medical School                            0.100302            0.710787                 1                   0.141114
Duke University School of Medicine                0.246991            0.66683                  1                   0.370395
Boston University School of Medicine              0.100302            0.710787                 1                   0.141114
Perelman School of Medicine                       0.26908             0.653143                 1                   0.411977
University of Wisconsin                           0.226581            0.64686                  0                   0.350278
University of North Carolina                      0.176684            0.6637                   0                   0.26621
Standford University School of Medicine           0.0780054           0.656658                 1                   0.118791
Johns Hopkins Univerty School of Medicine         0.38124             0.606103                 1                   0.629002
Northwestern University                           0.221883            0.677341                 0                   0.32758
Indiana University                                0.335939            0.501944                 0                   0.669276
Case Western Reserve                              0.211817            0.536384                 1                   0.394898
Emory University                                  0.206169            0.576814                 1                   0.357427
University of Massachusetts                       0.19562             0.64686                  1                   0.302414

The top 20 sorted by Score (Median/House * Tuition/Salary) are:
Name of Institution                               Median/House Price  Tuition Over 8 Years     Has Space Industry? Score

Indiana University                                0.335939            0.501944                 0                   0.669276
University of Alabama                             0.463577            0.722279                 1                   0.641825
Johns Hopkins Univerty School of Medicine         0.38124             0.606103                 1                   0.629002
Ohio State University                             0.32499             0.610704                 1                   0.532156
University of Maryland                            0.38124             0.722617                 1                   0.527583
Medical University of SC                          0.185816            0.354728                 0                   0.523827
University of Utah                                0.140142            0.311285                 0                   0.450205
Perelman School of Medicine                       0.26908             0.653143                 1                   0.411977
Case Western Reserve                              0.211817            0.536384                 1                   0.394898
Duke University School of Medicine                0.246991            0.66683                  1                   0.370395
Emory University                                  0.206169            0.576814                 1                   0.357427
University of Wisconsin                           0.226581            0.64686                  0                   0.350278
Chicago Medical School                            0.221883            0.648157                 0                   0.342329
Northwestern University                           0.221883            0.677341                 0                   0.32758
University of Massachusetts                       0.19562             0.64686                  1                   0.302414
Geisel School of Medicine                         0.205529            0.71526                  0                   0.287349
University of North Carolina                      0.176684            0.6637                   0                   0.26621
University of Michigan Medical School             0.158465            0.637237                 1                   0.248675
Georgetown University                             0.128883            0.604001                 1                   0.213382
University of California, SD                      0.109214            0.531397                 1                   0.205523

EDIT 3:
I Greatly Apologize for those who tried to compile this program. It now compiles and runs.

A:

When you do something like a sort or a set_intersection, you can specify how comparison should be done. If you don't specify anything, operator< for the type will be used (if it's defined).
In this case, it seems like you probably want to use partial_sort_copy instead of sort. This will let you get (for example) the top 10 schools by each sorting.
Then you'll have to re-sort those by name to do the set_intersection.
Then you'll do the set_intersection to get the schools that are common between those collections.
Here's some demo code:
#include <iostream>
#include <algorithm>
#include <vector>
#include <memory>

struct School
{
    std::string name;
    double housing;
    double tuition;
    int rank;
    int weight;

    // default comparison to use if nothing else is specified:
    bool operator<(School const &other) const { return name < other.name; }
};

int main()
{
    std::vector<School> schools{
        {"School1", 40.3, 20.0, 3, 6},
        {"School2", 10.3, 10.4, 5, 1},
        {"School3", 33.3, 23.5, 1, 2},
        {"School4", 8.5, 15.5, 4, 8}
    };

    // We specify the size of each of these as 3, so when we do the
    // partial_sort_copy, it'll fill in the top 3 for that category.
    std::vector<School> byHousing(3);
    std::vector<School> byRank(3);
    std::vector<School> byWeight(3);

    std::partial_sort_copy(schools.begin(), schools.end(), byHousing.begin(), byHousing.end(),
                           [](School const &a, School const &b) { return a.housing < b.housing; });

    std::partial_sort_copy(schools.begin(), schools.end(), byRank.begin(), byRank.end(),
                           [](School const &a, School const &b) { return a.rank < b.rank; });

    std::partial_sort_copy(schools.begin(), schools.end(), byWeight.begin(), byWeight.end(),
                           [](School const &a, School const &b) { return a.weight < b.weight; });

    std::sort(byHousing.begin(), byHousing.end());
    std::sort(byRank.begin(), byRank.end());
    std::sort(byWeight.begin(), byWeight.end());

    std::vector<School> temp, commonSchools;

    std::set_intersection(byHousing.begin(), byHousing.end(), byRank.begin(), byRank.end(),
                          std::back_inserter(temp));

    std::set_intersection(temp.begin(), temp.end(), byWeight.begin(), byWeight.end(),
                          std::back_inserter(commonSchools));

    std::cout << "Common Schools\n";
    for (auto const & e: commonSchools)
    {
        std::cout << e.name << "\n";
    }
}

Result:
Common Schools
School3

As an aside, it looked to me like making code using shared_ptr was going to add some extra work (and probably not gain enough to care about) so I didn't bother. I also left out the screening/sorting by tuition--it's pretty much just more of the same.

