Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding is_palindromic() algo to Boost.Algorithm #21

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

zamazan4ik
Copy link

Hello. I implemented is_palindromic() algo for Boost.Algorithm.

The algorithm compares container from two sides. You can use custom comparator. Also supported Boost.Range. Complexity is O(N).

Using is easy: you should give two bidirectional or most powerful iterators for [begin, end) and you may give custom comparator.

Result is bool.

Maybe you have some additions to this algorithm?

Best regards, Zaitsev Alexander.

@mclow
Copy link
Owner

mclow commented Jun 28, 2016

Needs tests ;-) Off the top of my head, it needs tests for: zero element input, single element, odd #, even #. That would be a good start.

The tests should exercise both the version that uses operator== and the one that takes a comparison functor explicitly.

@zamazan4ik
Copy link
Author

I tested it on tests like that: zero element input, single element, odd and even. Also I tested on set of random strings. Should I add my tests to tests on GitHub?

@mclow
Copy link
Owner

mclow commented Jun 28, 2016

Yes. The tests should be part of the pull request. Also, documentation.

@mclow
Copy link
Owner

mclow commented Jun 28, 2016

You can get most of the documentation that you want by putting doxygen comments in the source, but you'll have to write a description, rationale, etc.

@mclow
Copy link
Owner

mclow commented Jun 28, 2016

in your documentation, there should be "What should you use this for"? (so, real-world examples).

@zamazan4ik
Copy link
Author

Can I use in tests C++14?

@mclow
Copy link
Owner

mclow commented Jun 28, 2016

I would not if I were you; that would limit the people who run the tests. I don't see anything in the code you have that uses c++14.

@zamazan4ik
Copy link
Author

zamazan4ik commented Jun 28, 2016

You can't see it - it's not yet in the repo. It's my code for testing(using auto in arguments in lambda). Ok, I'll not use C++14. What about C++11? I think, it's widespread compiler.

@zamazan4ik
Copy link
Author

Can you send me your config file for doxygen? Because i don't know about style of Boost's documentation.

@zamazan4ik
Copy link
Author

I have done examples, tests and documentation. What should i do next?

@mclow
Copy link
Owner

mclow commented Jul 2, 2016

This is looking good.
Two comments: why call it is_palindromic, rather than just is_palindrome?
That's a simpler name.
What do you think?

Also, in the docs, you write:

The header file 'is_palindromic.hpp' contains four variants of a single algorithm, is_palindromic. The algorithm tests the sequence and returns true if the sequence is palindromic.

That doesn't really tell the reader anything. I think that this would be better:

The header file 'is_palindromic.hpp' contains four variants of a single algorithm, is_palindromic. The algorithm tests the sequence and returns true if the sequence is a palindrome; i.e, it is identical when traversed either backwards or frontwards.

(basically insert a definition of what a palindrome is)

@zamazan4ik
Copy link
Author

zamazan4ik commented Jul 2, 2016

Yes, i agree with your additions.

@zamazan4ik
Copy link
Author

zamazan4ik commented Jul 2, 2016

I wrote 'is_palindromic' because before aming of function i discuss about this with some other people. And first variant was 'is_palindromic'. But your variant is better, from my point of view. I don't know, why i didn't name function 'is_plaindrome' before your comment.

I rewrited name of function in the implementation, examples, tests, documents.

Something else?

@mclow
Copy link
Owner

mclow commented Jul 6, 2016

Ok; I think this is ready to commit. However, I'll be committing it manually, because this isn't the right place for it. My personal repo is different from the boost one. This should be committed to https://github.com/boostorg/algorithm:develop

@zamazan4ik
Copy link
Author

ok. For every next set of features should i create a new feature branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants