Function with

Summary

#include <include/type_safe/constrained_type.hpp>

(1) template <typename T, typename Constraint, class Verifier, typename Func, typename... Args>
    void with(constrained_type< T, Constraint, Verifier > &value, Func &&f, Args &&... additional_args)

#include <include/type_safe/reference.hpp>

(2) template <typename T, bool XValue, typename Func, typename... Args>
    void with(const object_ref< T, XValue > &ref, Func &&f, Args &&... additional_args)

(3) template <typename T, bool XValue, typename Func, typename... Args>
    void with(const array_ref< T, XValue > &ref, Func &&f, Args &&... additional_args)

#include <include/type_safe/tagged_union.hpp>

(4) template <typename... Types, typename Func, typename... Args>
    void with(tagged_union< Types... > &u, Func &&f, Args &&... additional_args)

(5) template <typename... Types, typename Func, typename... Args>
    void with(const tagged_union< Types... > &u, Func &&f, Args &&... additional_args)

(6) template <typename... Types, typename Func, typename... Args>
    void with(tagged_union< Types... > &&u, Func &&f, Args &&... additional_args)

(7) template <typename... Types, typename Func, typename... Args>
    void with(const tagged_union< Types... > &&u, Func &&f, Args &&... additional_args)

#include <include/type_safe/variant.hpp>

(8) template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
    void with(basic_variant< VariantPolicy, Head, Types... > &variant, Func &&func, Args &&... additional_args)

(9) template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
    void with(const basic_variant< VariantPolicy, Head, Types... > &variant, Func &&func, Args &&... additional_args)

(10) template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
     void with(basic_variant< VariantPolicy, Head, Types... > &&variant, Func &&func, Args &&... additional_args)

(11) template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
     void with(const basic_variant< VariantPolicy, Head, Types... > &&variant, Func &&func, Args &&... additional_args)

Function overload

Synopsis

#include <include/type_safe/constrained_type.hpp>

template <typename T, typename Constraint, class Verifier, typename Func, typename... Args>
void with(constrained_type< T, Constraint, Verifier > &value, Func &&f, Args &&... additional_args)

Description

With operation for [ts::constrained_type](). \effects Calls f with a non-const reference to the stored value of the [ts::constrained_type](). It checks that f does not change the validity of the object. \notes The same behavior can be accomplished by using the modify() member function.

Source

Lines 488-493 in include/type_safe/constrained_type.hpp.

template <typename T, typename Constraint, class Verifier, typename Func, typename... Args>
void with(constrained_type<T, Constraint, Verifier>& value, Func&& f, Args&&... additional_args)
{
    auto modifier = value.modify();
    std::forward<Func>(f)(modifier.get(), std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/reference.hpp>

template <typename T, bool XValue, typename Func, typename... Args>
void with(const object_ref< T, XValue > &ref, Func &&f, Args &&... additional_args)

Description

With operation for [ts::object_ref](). \effects Calls the operator() of f passing it *ref and the additional arguments.

Source

Lines 220-224 in include/type_safe/reference.hpp.

template <typename T, bool XValue, typename Func, typename... Args>
void with(const object_ref<T, XValue>& ref, Func&& f, Args&&... additional_args)
{
    std::forward<Func>(f)(*ref, std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/reference.hpp>

template <typename T, bool XValue, typename Func, typename... Args>
void with(const array_ref< T, XValue > &ref, Func &&f, Args &&... additional_args)

Description

With operation for [ts::array_ref](). \effects For every element of the array in order, it will invoke f, passing it the current element and the additional arguments. If XValue is true, it will pass an rvalue reference to the element, allowing it to be moved from.

Source

Lines 400-405 in include/type_safe/reference.hpp.

template <typename T, bool XValue, typename Func, typename... Args>
void with(const array_ref<T, XValue>& ref, Func&& f, Args&&... additional_args)
{
    for (auto&& elem : ref)
        f(std::forward<decltype(elem)>(elem), additional_args...);
}

Synopsis

#include <include/type_safe/tagged_union.hpp>

template <typename... Types, typename Func, typename... Args>
void with(tagged_union< Types... > &u, Func &&f, Args &&... additional_args)

Description

\effects If the union is empty, does nothing. Otherwise let the union contain an object of type T. If the functor is callable for the T, calls its operator() passing it the stored object. Else does nothing. \group union_with \module variant

Source

Lines 314-320 in include/type_safe/tagged_union.hpp.

template <typename... Types, typename Func, typename... Args>
void with(tagged_union<Types...>& u, Func&& f, Args&&... additional_args)
{
    detail::with_union<Func&&, decltype(u), typename tagged_union<Types...>::types,
                       Args&&...>::with(u, std::forward<Func>(f),
                                        std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/tagged_union.hpp>

template <typename... Types, typename Func, typename... Args>
void with(const tagged_union< Types... > &u, Func &&f, Args &&... additional_args)

Description

\group union_with

Source

Lines 323-329 in include/type_safe/tagged_union.hpp.

template <typename... Types, typename Func, typename... Args>
void with(const tagged_union<Types...>& u, Func&& f, Args&&... additional_args)
{
    detail::with_union<Func&&, decltype(u), typename tagged_union<Types...>::types,
                       Args&&...>::with(u, std::forward<Func>(f),
                                        std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/tagged_union.hpp>

template <typename... Types, typename Func, typename... Args>
void with(tagged_union< Types... > &&u, Func &&f, Args &&... additional_args)

Description

\group union_with

Source

Lines 332-338 in include/type_safe/tagged_union.hpp.

template <typename... Types, typename Func, typename... Args>
void with(tagged_union<Types...>&& u, Func&& f, Args&&... additional_args)
{
    detail::with_union<Func&&, decltype(u), typename tagged_union<Types...>::types,
                       Args&&...>::with(std::move(u), std::forward<Func>(f),
                                        std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/tagged_union.hpp>

template <typename... Types, typename Func, typename... Args>
void with(const tagged_union< Types... > &&u, Func &&f, Args &&... additional_args)

Description

\group union_with

Source

Lines 341-347 in include/type_safe/tagged_union.hpp.

template <typename... Types, typename Func, typename... Args>
void with(const tagged_union<Types...>&& u, Func&& f, Args&&... additional_args)
{
    detail::with_union<Func&&, decltype(u), typename tagged_union<Types...>::types,
                       Args&&...>::with(std::move(u), std::forward<Func>(f),
                                        std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/variant.hpp>

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(basic_variant< VariantPolicy, Head, Types... > &variant, Func &&func, Args &&... additional_args)

Description

\effects If the variant is empty, does nothing. Otherwise let the variant contain an object of type T. If the functor is callable for the T, calls its operator() passing it the stored object. Else does nothing. \module variant \group variant_with

Source

Lines 718-724 in include/type_safe/variant.hpp.

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(basic_variant<VariantPolicy, Head, Types...>& variant, Func&& func,
          Args&&... additional_args)
{
    with(detail::storage_access::get(variant).get_union(), std::forward<Func>(func),
         std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/variant.hpp>

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(const basic_variant< VariantPolicy, Head, Types... > &variant, Func &&func, Args &&... additional_args)

Description

\group variant_with

Source

Lines 727-733 in include/type_safe/variant.hpp.

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(const basic_variant<VariantPolicy, Head, Types...>& variant, Func&& func,
          Args&&... additional_args)
{
    with(detail::storage_access::get(variant).get_union(), std::forward<Func>(func),
         std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/variant.hpp>

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(basic_variant< VariantPolicy, Head, Types... > &&variant, Func &&func, Args &&... additional_args)

Description

\group variant_with

Source

Lines 736-742 in include/type_safe/variant.hpp.

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(basic_variant<VariantPolicy, Head, Types...>&& variant, Func&& func,
          Args&&... additional_args)
{
    with(std::move(detail::storage_access::get(variant).get_union()), std::forward<Func>(func),
         std::forward<Args>(additional_args)...);
}

Synopsis

#include <include/type_safe/variant.hpp>

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(const basic_variant< VariantPolicy, Head, Types... > &&variant, Func &&func, Args &&... additional_args)

Description

\group variant_with

Source

Lines 745-751 in include/type_safe/variant.hpp.

template <class VariantPolicy, typename Head, typename... Types, typename Func, typename... Args>
void with(const basic_variant<VariantPolicy, Head, Types...>&& variant, Func&& func,
          Args&&... additional_args)
{
    with(std::move(detail::storage_access::get(variant).get_union()), std::forward<Func>(func),
         std::forward<Args>(additional_args)...);
}





Add Discussion as Guest

Log in