mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
9c066e964d
Converted usage of CH-custom bit_cast to std::bit_cast if possible, i.e. when sizeof(From) == sizeof(To). (The CH-custom bit_cast is able to deal with sizeof(From) != sizeof(To).) Motivation for this came from #42847 where it is not clear how the internal bit_cast should behave on big endian systems, so we better avoid that situation as much as possible.
44 lines
897 B
C++
44 lines
897 B
C++
#pragma once
|
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
|
#include <Core/Block.h>
|
|
#include <base/range.h>
|
|
|
|
#include "ExternalDictionaryLibraryAPI.h"
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class CStringsHolder
|
|
{
|
|
|
|
public:
|
|
using Container = std::vector<std::string>;
|
|
|
|
explicit CStringsHolder(const Container & strings_pass)
|
|
{
|
|
strings_holder = strings_pass;
|
|
strings.size = strings_holder.size();
|
|
|
|
ptr_holder = std::make_unique<ExternalDictionaryLibraryAPI::CString[]>(strings.size);
|
|
strings.data = ptr_holder.get();
|
|
|
|
size_t i = 0;
|
|
for (auto & str : strings_holder)
|
|
{
|
|
strings.data[i] = str.c_str();
|
|
++i;
|
|
}
|
|
}
|
|
|
|
ExternalDictionaryLibraryAPI::CStrings strings; // will pass pointer to lib
|
|
|
|
private:
|
|
std::unique_ptr<ExternalDictionaryLibraryAPI::CString[]> ptr_holder = nullptr;
|
|
Container strings_holder;
|
|
};
|
|
|
|
|
|
}
|