Skip to content

Commit

Permalink
Using emplace when OK
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Sep 26, 2023
1 parent 9023d6b commit 66d19b5
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions barry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5378,7 +5378,7 @@ COUNTERS_TEMPLATE(void, add_counter)(
)
{

data.push_back(Counter<Array_Type,Data_Type>(
data.emplace_back(Counter<Array_Type,Data_Type>(
count_fun_,
init_fun_,
hasher_fun_,
Expand Down Expand Up @@ -7904,7 +7904,7 @@ MODEL_TEMPLATE(size_t, add_array)(
{

auto tmpcounts = counter_fun.count_all();
stats_target.push_back(
stats_target.emplace_back(
transform_model_fun(&tmpcounts[0u], tmpcounts.size())
);

Expand Down
6 changes: 3 additions & 3 deletions defm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ inline void counter_transition(
#ifdef BARRY_WITH_LATEX
name += ") -> (";
#else
name += "} \u21E8 {";
name += std::string("}") + u8"\u21E8" + std::string("{");
#endif
else
#ifdef BARRY_WITH_LATEX
Expand Down Expand Up @@ -1529,10 +1529,10 @@ inline DEFM::DEFM(

// Creating the names
for (auto i = 0u; i < Y_ncol; ++i)
Y_names.push_back(std::string("y") + std::to_string(i));
Y_names.emplace_back(std::string("y") + std::to_string(i));

for (auto i = 0u; i < X_ncol; ++i)
X_names.push_back(std::string("X") + std::to_string(i));
X_names.emplace_back(std::string("X") + std::to_string(i));

return;

Expand Down
2 changes: 1 addition & 1 deletion include/barry/barrayvector-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inline void BArrayVector<Cell_Type,Data_Type>::init_vec() {
} else {

for (const auto& a : Array->el_ji[i])
vec.push_back(std::make_pair<size_t, Cell<Cell_Type>>(a.first, *(a.second)));
vec.emplace_back(std::make_pair<size_t, Cell<Cell_Type>>(a.first, *(a.second)));

}

Expand Down
2 changes: 1 addition & 1 deletion include/barry/counters-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ COUNTERS_TEMPLATE(void, add_counter)(
)
{

data.push_back(Counter<Array_Type,Data_Type>(
data.emplace_back(Counter<Array_Type,Data_Type>(
count_fun_,
init_fun_,
hasher_fun_,
Expand Down
2 changes: 1 addition & 1 deletion include/barry/model-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ MODEL_TEMPLATE(size_t, add_array)(
{

auto tmpcounts = counter_fun.count_all();
stats_target.push_back(
stats_target.emplace_back(
transform_model_fun(&tmpcounts[0u], tmpcounts.size())
);

Expand Down
2 changes: 1 addition & 1 deletion include/barry/models/defm/counters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ inline void counter_transition(
#ifdef BARRY_WITH_LATEX
name += ") -> (";
#else
name += "} \u21E8 {";
name += std::string("}") + u8"\u21E8" + std::string("{");
#endif
else
#ifdef BARRY_WITH_LATEX
Expand Down
4 changes: 2 additions & 2 deletions include/barry/models/defm/defm-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ inline DEFM::DEFM(

// Creating the names
for (auto i = 0u; i < Y_ncol; ++i)
Y_names.push_back(std::string("y") + std::to_string(i));
Y_names.emplace_back(std::string("y") + std::to_string(i));

for (auto i = 0u; i < X_ncol; ++i)
X_names.push_back(std::string("X") + std::to_string(i));
X_names.emplace_back(std::string("X") + std::to_string(i));

return;

Expand Down
2 changes: 1 addition & 1 deletion include/barry/models/geese/flock-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inline size_t Flock::add_data(
}

// Generating the Geese object
dat.push_back(Geese(annotations, geneid, parent, duplication));
dat.emplace_back(Geese(annotations, geneid, parent, duplication));

if (dat.size() == 1u)
this->nfunctions = dat[0].nfuns();
Expand Down
6 changes: 3 additions & 3 deletions include/barry/models/geese/geese-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ inline void Geese::init(size_t bar_width) {
for (auto& iter : pset.data)
{

states.push_back(std::vector< bool >(nfunctions, false));
states.emplace_back(std::vector< bool >(nfunctions, false));

for (auto j = 0u; j < nfunctions; ++j)
{
Expand Down Expand Up @@ -539,7 +539,7 @@ inline std::vector< std::vector<double> > Geese::observed_counts()
if (n.second.is_leaf())
{

ans.push_back({});
ans.emplace_back(std::vector<double>({}));
continue;

}
Expand Down Expand Up @@ -605,7 +605,7 @@ inline void Geese::print_observed_counts()
for (auto& n : nodes) {

if (n.second.is_leaf()) {
ans.push_back({});
ans.emplace_back(std::vector< double >({}));
continue;
}

Expand Down

0 comments on commit 66d19b5

Please sign in to comment.