DiSMEC++
generic.h
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #ifndef DISMEC_GENERIC_H
7 #define DISMEC_GENERIC_H
8 
9 #include "training/postproc.h"
10 
11 namespace dismec::postproc {
12  template<class T, class... Args>
14  public:
15  explicit GenericPostProcFactory(Args... args) : m_Args( std::move(args)...) {
16  }
17 
18  [[nodiscard]] std::unique_ptr<PostProcessor> make_processor(const std::shared_ptr<objective::Objective>& objective) const override {
19  return std::apply([&](const auto&... args){ return std::make_unique<T>(objective, args...); }, m_Args);
20  }
21 
22  std::tuple<Args...> m_Args;
23  };
24 }
25 
26 #endif //DISMEC_GENERIC_H
std::tuple< Args... > m_Args
Definition: generic.h:22
std::unique_ptr< PostProcessor > make_processor(const std::shared_ptr< objective::Objective > &objective) const override
Definition: generic.h:18