int main() { { std::tuple<> t(std::allocator_arg, A1<int>()); } { std::tuple<int> t(std::allocator_arg, A1<int>()); assert(std::get<0>(t) == 0); } { std::tuple<DefaultOnly> t(std::allocator_arg, A1<int>()); assert(std::get<0>(t) == DefaultOnly()); } { assert(!alloc_first::allocator_constructed); std::tuple<alloc_first> t(std::allocator_arg, A1<int>(5)); assert(alloc_first::allocator_constructed); assert(std::get<0>(t) == alloc_first()); } { assert(!alloc_last::allocator_constructed); std::tuple<alloc_last> t(std::allocator_arg, A1<int>(5)); assert(alloc_last::allocator_constructed); assert(std::get<0>(t) == alloc_last()); } { alloc_first::allocator_constructed = false; std::tuple<DefaultOnly, alloc_first> t(std::allocator_arg, A1<int>(5)); assert(std::get<0>(t) == DefaultOnly()); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first()); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<DefaultOnly, alloc_first, alloc_last> t(std::allocator_arg, A1<int>(5)); assert(std::get<0>(t) == DefaultOnly()); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first()); assert(alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last()); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<DefaultOnly, alloc_first, alloc_last> t(std::allocator_arg, A2<int>(5)); assert(std::get<0>(t) == DefaultOnly()); assert(!alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first()); assert(!alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last()); } }
// add, update application list void py_updateSinkInput(pa_sink_input_info* info) { printf("func.c: update time = %d\n", notify_index); printf("func.c: index = %i\n", info->index); printf("func.c: name = %c\n", *info->name); printf("func.c: client = %i\n", info->client);// unique one printf("func.c: sink = %i\n", info->sink); printf("func.c: driver = %c\n", *info->driver); // if **root is not allocated allocate it first if(!allocated) alloc_first(); else printf("func.c: root will not allocated this time\n"); root[notify_index] = (notify*)calloc(1,sizeof(notify)); root[notify_index]->client = info->client; printf("func.c:INF: entering sprintf\n"); sprintf(root[notify_index]->name, "member %d", notify_index); if (notify_index > 0){ printf("func.c:INF: adding chain\n"); root[notify_index - 1]->next = root[notify_index]; } notify_index++; }
int main() { { std::tuple<int> t(std::allocator_arg, A1<int>(), 3); assert(std::get<0>(t) == 3); } { assert(!alloc_first::allocator_constructed); std::tuple<alloc_first> t(std::allocator_arg, A1<int>(5), alloc_first(3)); assert(alloc_first::allocator_constructed); assert(std::get<0>(t) == alloc_first(3)); } { assert(!alloc_last::allocator_constructed); std::tuple<alloc_last> t(std::allocator_arg, A1<int>(5), alloc_last(3)); assert(alloc_last::allocator_constructed); assert(std::get<0>(t) == alloc_last(3)); } { alloc_first::allocator_constructed = false; std::tuple<int, alloc_first> t(std::allocator_arg, A1<int>(5), 10, alloc_first(15)); assert(std::get<0>(t) == 10); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first(15)); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<int, alloc_first, alloc_last> t(std::allocator_arg, A1<int>(5), 1, alloc_first(2), alloc_last(3)); assert(std::get<0>(t) == 1); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first(2)); assert(alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last(3)); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<int, alloc_first, alloc_last> t(std::allocator_arg, A2<int>(5), 1, alloc_first(2), alloc_last(3)); assert(std::get<0>(t) == 1); assert(!alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first(2)); assert(!alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last(3)); } }
int main() { { std::tuple<MoveOnly> t(std::allocator_arg, A1<int>(), MoveOnly(0)); assert(std::get<0>(t) == 0); } { std::tuple<MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), MoveOnly(0), MoveOnly(1)); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); } { std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), MoveOnly(0), 1, 2); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); assert(std::get<2>(t) == 2); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<int, alloc_first, alloc_last> t(std::allocator_arg, A1<int>(5), 1, 2, 3); assert(std::get<0>(t) == 1); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first(2)); assert(alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last(3)); } // extensions { std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), 0, 1); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); assert(std::get<2>(t) == MoveOnly()); } { std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), 0); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == MoveOnly()); assert(std::get<2>(t) == MoveOnly()); } }
int main() { { std::tuple<> t(std::allocator_arg, A1<int>()); } { std::tuple<int> t(std::allocator_arg, A1<int>()); assert(std::get<0>(t) == 0); } { std::tuple<DefaultOnly> t(std::allocator_arg, A1<int>()); assert(std::get<0>(t) == DefaultOnly()); } { assert(!alloc_first::allocator_constructed); std::tuple<alloc_first> t(std::allocator_arg, A1<int>(5)); assert(alloc_first::allocator_constructed); assert(std::get<0>(t) == alloc_first()); } { assert(!alloc_last::allocator_constructed); std::tuple<alloc_last> t(std::allocator_arg, A1<int>(5)); assert(alloc_last::allocator_constructed); assert(std::get<0>(t) == alloc_last()); } { alloc_first::allocator_constructed = false; std::tuple<DefaultOnly, alloc_first> t(std::allocator_arg, A1<int>(5)); assert(std::get<0>(t) == DefaultOnly()); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first()); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<DefaultOnly, alloc_first, alloc_last> t(std::allocator_arg, A1<int>(5)); assert(std::get<0>(t) == DefaultOnly()); assert(alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first()); assert(alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last()); } { alloc_first::allocator_constructed = false; alloc_last::allocator_constructed = false; std::tuple<DefaultOnly, alloc_first, alloc_last> t(std::allocator_arg, A2<int>(5)); assert(std::get<0>(t) == DefaultOnly()); assert(!alloc_first::allocator_constructed); assert(std::get<1>(t) == alloc_first()); assert(!alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last()); } { // Test that the uses-allocator default constructor does not evaluate // its SFINAE when it otherwise shouldn't be selected. Do this by // using 'NonDefaultConstructible' which will cause a compile error // if std::is_default_constructible is evaluated on it. using T = NonDefaultConstructible<>; T v(42); std::tuple<T, T> t(v, v); (void)t; std::tuple<T, T> t2(42, 42); (void)t2; } }