• Main Page
  • Classes
  • Files
  • File List

Swiften/Base/Concat.h

00001 /*
00002  * Copyright (c) 2011 Remko Tronçon
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 namespace Swift {
00010   template<typename C>
00011   C concat(const C& c1, const C& c2) {
00012     C result;
00013     result.resize(c1.size() + c2.size());
00014     std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()));
00015     return result;
00016   }
00017 
00018   template<typename C>
00019   C concat(const C& c1, const C& c2, const C& c3) {
00020     C result;
00021     result.resize(c1.size() + c2.size() + c3.size());
00022     std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())));
00023     return result;
00024   }
00025 
00026   template<typename C>
00027   C concat(const C& c1, const C& c2, const C& c3, const C& c4) {
00028     C result;
00029     result.resize(c1.size() + c2.size() + c3.size() + c4.size());
00030     std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))));
00031     return result;
00032   }
00033 
00034   template<typename C>
00035   C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5) {
00036     C result;
00037     result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size());
00038     std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))));
00039     return result;
00040   }
00041 
00042   template<typename C>
00043   C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6) {
00044     C result;
00045     result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size());
00046     std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))))));
00047     return result;
00048   }
00049 
00050   template<typename C>
00051   C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7) {
00052     C result;
00053     result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size());
00054     std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))))));
00055     return result;
00056   }
00057 
00058   template<typename C>
00059   C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7, const C& c8) {
00060     C result;
00061     result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size() + c8.size());
00062     std::copy(c8.begin(), c8.end(), std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))))))));
00063     return result;
00064   }
00065 
00066   template<typename C>
00067   C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7, const C& c8, const C& c9) {
00068     C result;
00069     result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size() + c8.size() + c9.size());
00070     std::copy(c9.begin(), c9.end(), std::copy(c8.begin(), c8.end(), std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))))))));
00071     return result;
00072   }
00073 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1