用0替换非空白单元格

时间:2016-10-16 20:07:00

标签: replace scripting google-sheets

我尝试在线查找解决方案,但找不到专门针对我需要的解决方案:我想创建一个脚本,用0替换给定列中的非空单元格。

这有一个简单的解决方案吗?

感谢。

1 个答案:

答案 0 :(得分:0)

尝试:

template<typename ...Args>
struct List;

template<typename T>
struct ListFromTupleImpl;
template<typename ...Args>
struct ListFromTupleImpl<std::tuple<Args...>>
{ using type = List<Args...>; };

template<typename T>
using ListFromTuple = typename ListFromTupleImpl<T>::type;
template<typename ...Args>
using TupleCat = decltype(std::tuple_cat(std::declval<Args>()...));
template<typename ...Args>
using ListFromTupleCat = ListFromTuple<TupleCat<Args...>>;

template<int ...Args>
struct IntList;

template<typename ...Args>
struct List
{
    template<typename T>
    struct Concat;
    template<typename ...Args0>
    struct Concat<List<Args0...>>
    {
        using type = ListFromTupleCat<std::tuple<Args...>,
                                      std::tuple<Args0...>>;
    };
};

template<int ...Args>
struct IntList
{
    template<int first, int ...Args0>
    struct ListBuilder
    {
        using type = typename List<std::integral_constant<int, first>>::
                    template Concat<typename ListBuilder<Args0...>::type>::type;
    };
    template<int last>
    struct ListBuilder<last>
    {
        using type = List<std::integral_constant<int, last>>;
    };
    using asList = typename ListBuilder<Args...>::type;
};