mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-03 14:14:11 +00:00
Add support for char[N] to the run() method.
This commit is contained in:
parent
efd7118189
commit
ba8e8b9f7b
1 changed files with 11 additions and 0 deletions
|
@ -65,6 +65,17 @@ namespace redis {
|
||||||
const char m_data;
|
const char m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <std::size_t N>
|
||||||
|
struct MakeCharInfo<char[N]> {
|
||||||
|
static_assert(N > 0, "Given input should have at least one character as it's assumed to be a null-terminated string");
|
||||||
|
MakeCharInfo ( const char (&parData)[N] ) : m_data(parData, N - 1) {}
|
||||||
|
const char* data ( void ) const { return m_data.data(); }
|
||||||
|
std::size_t size ( void ) const { return m_data.size(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::string_ref m_data;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const char* arg_to_bin_safe_char (const T& parArg) {
|
inline const char* arg_to_bin_safe_char (const T& parArg) {
|
||||||
return MakeCharInfo<T>(parArg).data();
|
return MakeCharInfo<T>(parArg).data();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue