Sha256: 1cdf88a95c3fb712a3ba13ff04f27e2cf499c6a9cc8c1bb0b0248a9f5b9b8f29

Contents?: true

Size: 464 Bytes

Versions: 396

Compression:

Stored size: 464 Bytes

Contents

#include "grade_school.h"
#include <algorithm>

using namespace std;

namespace grade_school
{

void school::add(string const& name, int grade)
{
    vector<string>& grade_roster = roster_[grade];
    auto it = lower_bound(grade_roster.begin(), grade_roster.end(), name);
    grade_roster.insert(it, name);
}

vector<string> school::grade(int grade) const
{
    auto it = roster_.find(grade);
    return (it != roster_.end()) ? it->second : vector<string>{};
}

}

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.179 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.178 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.177 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.176 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.175 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.174 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.173 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.172 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.171 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.170 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.169 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.167 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.166 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.165 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.164 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.163 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.162 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.161 tracks/cpp/exercises/grade-school/example.cpp
trackler-2.2.1.160 tracks/cpp/exercises/grade-school/example.cpp