emplace.h
Go to the documentation of this file.
00001 /* Copyright 2011 Savarese Software Research Corporation 00002 * 00003 * Licensed under the Apache License, Version 2.0 (the "License"); 00004 * you may not use this file except in compliance with the License. 00005 * You may obtain a copy of the License at 00006 * 00007 * https://www.savarese.com/software/ApacheLicense-2.0 00008 * 00009 * Unless required by applicable law or agreed to in writing, software 00010 * distributed under the License is distributed on an "AS IS" BASIS, 00011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 * See the License for the specific language governing permissions and 00013 * limitations under the License. 00014 */ 00015 00022 #ifndef __SSRC_WSPR_UTILITY_EMPLACE_H 00023 #define __SSRC_WSPR_UTILITY_EMPLACE_H 00024 00025 #include <ssrc/wispers-packages.h> 00026 00027 #include <utility> 00028 00029 __BEGIN_NS_SSRC_WSPR_UTILITY 00030 00031 template<typename container_type, typename P> 00032 inline void emplace(container_type & container, P && p) { 00033 container.insert(p); 00034 } 00035 00036 // TODO: Should check to see if container has emplace function and 00037 // should forward to that if available. 00038 template<typename container_type, typename T, typename... P> 00039 inline void emplace(container_type & container, T && t, P && ...p) { 00040 container.insert(t); 00041 emplace(container, std::forward<P>(p)...); 00042 } 00043 00044 __END_NS_SSRC_WSPR_UTILITY 00045 00046 #endif
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.