Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #6255
| From | Kaz Kylheku <330-706-9395@kylheku.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Designing a suite of algorithms in C++ |
| Date | 2016-02-01 23:24 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <20160201151941.461@kylheku.com> (permalink) |
| References | <2df6fc12-e6c9-4f5b-bdb7-21e35a57edbb@googlegroups.com> |
On 2016-02-01, Paul <pepstein5@gmail.com> wrote:
> class Algorithm{
>
> public:
> Algorithm(some parameters);
> virtual void findSolution() = 0;
> virtual ~Algorithm()
> {}
> };
This interface only supports algorithms that either find a solution, for
any combination of parameters, or else do not terminate.
Your findSolution function has no way to indicate "I have stopped
searching, and found no solution".
If the function returns, since it has no return value, and the
interface has no useful member functions to inspect any state,
we can assume that the solution was found. So if the solution cannot
be found, the function doesn't return, right?
Not to mention that, quite often, when algorithms find a solution,
we want to know *what* that solution is, not only *that* it exists.
Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread
Designing a suite of algorithms in C++ Paul <pepstein5@gmail.com> - 2016-02-01 03:38 -0800
Re: Designing a suite of algorithms in C++ Mark Carroll <mtbc@bcs.org> - 2016-02-01 12:04 +0000
Re: Designing a suite of algorithms in C++ Paul <pepstein5@gmail.com> - 2016-02-01 05:52 -0800
Re: Designing a suite of algorithms in C++ Mark Carroll <mtbc@bcs.org> - 2016-02-01 15:10 +0000
Re: Designing a suite of algorithms in C++ Paul N <gw7rib@aol.com> - 2016-02-01 14:15 -0800
Re: Designing a suite of algorithms in C++ BartC <bc@freeuk.com> - 2016-02-01 23:00 +0000
Re: Designing a suite of algorithms in C++ Kaz Kylheku <330-706-9395@kylheku.com> - 2016-02-01 23:24 +0000
csiph-web