Skip to content

Commit

Permalink
Merge pull request #160 from grenewode/attributes/fix_integer_convers…
Browse files Browse the repository at this point in the history
…ion_errors
  • Loading branch information
mercere99 authored Apr 8, 2018
2 parents 434cbd2 + 0f78990 commit f149040
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions examples/tools/attrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ constexpr auto DEFAULT{MakeAttrs(PopulationSize(100), GenerationLength(100),
// Notice that this function has a different ordering than DEFAULT
void print(
const std::string& name,
const Attrs<PopulationSizeValue<size_t>, DefaultGenomeValue<std::string>,
GenerationLengthValue<size_t>>& args) {
const Attrs<PopulationSizeValue<int>, DefaultGenomeValue<std::string>,
GenerationLengthValue<int>>& args) {
std::cout << name << " = " << args << std::endl;
}

void printSubset(
const std::string& name,
const Attrs<typename PopulationSize::value_t<size_t>,
typename GenerationLength::value_t<size_t>>& args) {
void printSubset(const std::string& name,
const Attrs<typename PopulationSize::value_t<int>,
typename GenerationLength::value_t<int>>& args) {
std::cout << name << " = " << args << std::endl;
}

Expand All @@ -43,10 +42,10 @@ int main() {
"Using Universal Constructor: ",
{PopulationSize(1), DefaultGenome("Hello World"), GenerationLength(50)});

Attrs<typename PopulationSize::value_t<size_t>,
Attrs<typename PopulationSize::value_t<int>,
typename DefaultGenome::value_t<std::string>, // Notice that this will
// be auto-converted
typename GenerationLength::value_t<size_t>>
typename GenerationLength::value_t<int>>
user = DEFAULT;
// Set a single member
user.SetDefaultGenome("ASDEDFDFSA");
Expand Down

0 comments on commit f149040

Please sign in to comment.