コード例 #1
0
ファイル: ordered.hpp プロジェクト: ThePhD/lua-bench
	iterator emplace(Tn&&... argn) {
		if (container.empty()) {
			return container.emplace(cend(), std::forward<Tn>(argn)...);
		}
		auto elementgreaterthanorequalto = std::lower_bound(cbegin(), cend(), val, std::ref(compare_predicate));
		return container.emplace(elementgreaterthanorequalto, std::forward<Tn>(argn)...);
	}
コード例 #2
0
ファイル: ordered.hpp プロジェクト: ThePhD/vlm_performance
	iterator emplace(Tn&&... argn) {
		if (container.empty()) {
			return container.insert(detail::adl_cend(container), std::forward<Tn>(argn)...);
		}
		auto elementgreaterthanorequalto = std::lower_bound(detail::adl_cbegin(container), detail::adl_cend(container), val, std::ref(predicate));
		return container.emplace(elementgreaterthanorequalto, std::forward<Tn>(argn)...);
	}
コード例 #3
0
ファイル: main.cpp プロジェクト: WhiZTiM/coliru
 inline std::enable_if_t<std::is_base_of<T, std::decay_t<U>>::value> push(U&& value) {
     std::unique_lock<std::mutex> lock(mut);
     // only add the value on the stack if there is room
     data_cond.wait(lock, [this]{
         return (data_queue.size() < capacity) || shutdownFlag;
     });
     data_queue.emplace(std::make_shared<
         std::decay_t<U>> (std::forward<U>(value)));
     data_cond.notify_one();
 }
コード例 #4
0
ファイル: main.cpp プロジェクト: WhiZTiM/coliru
 inline std::enable_if_t<std::is_base_of<T, U>::value> push(std::shared_ptr<U>&& ptr)
 {
     std::unique_lock<std::mutex> lock(mut);
     // only add the value on the stack if there is room
     data_cond.wait(lock, [this]{
         return (data_queue.size() < capacity) || shutdownFlag;
     });
     if (!shutdownFlag) {
         data_queue.emplace(std::move(ptr)); // move the pointer
     }
     data_cond.notify_one();
 }
コード例 #5
0
ファイル: ordered.hpp プロジェクト: ThePhD/vlm_performance
	iterator emplace(Tn&&... argn) {
		auto x = container.emplace(std::forward<Tn>(argn)...);
		return x.first;
	}