本文整理汇总了C++中std::reference_wrapper类的典型用法代码示例。如果您正苦于以下问题:C++ reference_wrapper类的具体用法?C++ reference_wrapper怎么用?C++ reference_wrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了reference_wrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_range
result_list runner::test_range(files_iterator begin, files_iterator end, std::reference_wrapper<report_type> report) const
{
config defaults;
result_list results;
for (runner::files_iterator i = begin; i != end; i++)
{
runner::path_type const & file = *i;
if (file.extension() == ".xml")
{
try
{
result_list r = test_one(file, defaults, report);
std::move(r.begin(), r.end(), std::back_inserter(results));
}
catch (std::exception const& ex)
{
result r;
r.state = STATE_ERROR;
r.name = file.string();
r.error_message = ex.what();
results.emplace_back(r);
mapnik::util::apply_visitor(report_visitor(r), report.get());
}
}
}
return results;
}
示例2: get
static std::shared_ptr<Data> get(std::reference_wrapper<T> obj, bool t_return_value)
{
auto p = &obj.get();
return std::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
chaiscript::detail::Any(std::move(obj)),
true,
p,
t_return_value
);
}
示例3: jsonStoreInterpolations
void jsonStoreInterpolations(std::reference_wrapper<RevisionThree> json, const InterpolationList &interpolations)
{
namespace Base64VLQ = SourceMap::intern::Base64VLQ;
if (interpolations.empty()) return; // nothing to store
QString encoded;
for(const auto& p : interpolations) {
Base64VLQ::encode(encoded, static_cast<int>(p.first));
Base64VLQ::encode(encoded, p.second);
}
json.get().insert(INTERPOLATIONS_KEY, encoded);
}
示例4: consume
void consume(std::reference_wrapper<T>& x) {
return consume(x.get());
}
示例5: operator
void operator()(msgpack::object::with_zone& o, const std::reference_wrapper<T>& v) const {
msgpack::adaptor::object_with_zone<typename std::remove_const<T>::type>()(o, v.get());
}
示例6: operator
ranges::reference_wrapper<T> operator()(std::reference_wrapper<T> ref) const
{
return ranges::ref(ref.get());
}
示例7: output_stream
output_stream(std::reference_wrapper<std::ostream> os)
: write_f(make_std_ostream_write_function(os.get()))
{}
示例8: optional
optional(const std::reference_wrapper<Tc>& t) : optional(std::addressof(t.get())) {
}
示例9: operator
reference_wrapper<T> operator()(std::reference_wrapper<T> t) const
{
return {t.get()};
}
示例10: cmp
static inline bool cmp(const T& lhs, const std::reference_wrapper<U>& rhs) {
return vg_cmp<T>::_(lhs, rhs.get());
}
示例11: operator
void operator() ()
{
results.get().call = true;
}
示例12: write
/**
* Write implementation delegated to the underlying sink
*
* @param buffer source buffer
* @param length number of bytes to process
* @return number of bytes processed
*/
std::streamsize write(const char* buffer, std::streamsize length) {
return sink.get().write(buffer, length);
}
示例13: read
/**
* Read implementation delegated to the underlying source
*
* @param buffer output buffer
* @param length number of bytes to process
* @return number of bytes processed
*/
std::streamsize read(char* buffer, std::streamsize length) {
return src.get().read(buffer, length);
}
示例14:
/**
* Underlying source accessor
*
* @return underlying source reference
*/
Source& get_source() {
return src.get();
}
示例15: flush
/**
* Flushes destination sink
*
* @return number of bytes flushed
*/
std::streamsize flush() {
return sink.get().flush();
}