Skip to content

Commit

Permalink
Merge pull request #5 from rschu1ze/decode-string_view
Browse files Browse the repository at this point in the history
Pass sqid into decode() as `std::string_view`
  • Loading branch information
laserpants authored Jan 5, 2024
2 parents 3756e53 + 2bf7a02 commit a471f53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/sqids/sqids.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Sqids
bool containsMultibyteCharacters(const std::string& input) const;

std::string encode(const std::vector<T>& numbers) const;
std::vector<T> decode(const std::string& id) const;
std::vector<T> decode(std::string_view id) const;

static constexpr T maxValue = std::numeric_limits<T>::max();

Expand Down Expand Up @@ -294,7 +294,7 @@ std::string Sqids<T>::encode(const std::vector<T>& numbers) const
/// @return The sequence of integers
///
template<typename T>
typename std::vector<T> Sqids<T>::decode(const std::string& id) const
typename std::vector<T> Sqids<T>::decode(std::string_view id) const
{
// If an empty string is given, return an empty sequence
if (id.empty()) {
Expand Down

0 comments on commit a471f53

Please sign in to comment.