Wordsearch Solver
Public Member Functions | Private Attributes | List of all members
solver::SolverDictFactory Class Reference

This class can be used to check if a particular dictionary solver implementation exists, and create an instance of one with a particular dictionary. More...

#include <solver.hpp>

Public Member Functions

bool has_solver (const std::string_view solver) const
 Check if a dictionary solver implementation called solver exists. More...
 
auto solver_names () const -> decltype(ranges::views::all(solvers))
 A view onto the names of available solvers. More...
 
template<class Words >
SolverDictWrapper make (const std::string_view solver, Words &&dictionary) const
 Make a dictionary solver. More...
 

Private Attributes

std::vector< std::string > solvers
 

Detailed Description

This class can be used to check if a particular dictionary solver implementation exists, and create an instance of one with a particular dictionary.

See example/example.cpp for how to use it

Note
The implementation behind this sucks. All the information required is available at compile time, namely what solver implementations were compiled. However, I cannot find a way to implement the interface to this class like this, and SolverDictWrapper like it is, if the solvers are stored in something like a boost::hana::tuple. Ie. I want to store the immutable data in a compile time data structure like a boost::hana::tuple, but be able to query it using runtime parameters like std::strings. As a result, this uses a std::vector<std::string> and some filthy macros instead.

Member Function Documentation

◆ has_solver()

bool solver::SolverDictFactory::has_solver ( const std::string_view  solver) const

Check if a dictionary solver implementation called solver exists.

Parameters
[in]solverThe name of the dictionary solver implementation
Returns
A bool indicating whether a solver with that name xists

◆ make()

template<class Words >
SolverDictWrapper solver::SolverDictFactory::make ( const std::string_view  solver,
Words &&  dictionary 
) const

Make a dictionary solver.

Parameters
[in]solverName of the dictionary solver implementation
[in]dictionaryList of words to use as a dictionary
Returns
An initialised SolverDictWrapper

◆ solver_names()

auto solver::SolverDictFactory::solver_names ( ) const -> decltype(ranges::views::all(solvers))

A view onto the names of available solvers.

Return type leaks implementation details, I dislike it but am unsure how to avoid it


The documentation for this class was generated from the following files: