"Fossies" - the Fresh Open Source Software Archive

Member "apache-zookeeper-3.5.6/zookeeper-client/zookeeper-client-c/tests/Vector.h" (5 Oct 2019, 1242 Bytes) of package /linux/misc/apache-zookeeper-3.5.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /**
    2  * Licensed to the Apache Software Foundation (ASF) under one
    3  * or more contributor license agreements.  See the NOTICE file
    4  * distributed with this work for additional information
    5  * regarding copyright ownership.  The ASF licenses this file
    6  * to you under the Apache License, Version 2.0 (the
    7  * "License"); you may not use this file except in compliance
    8  * with the License.  You may obtain a copy of the License at
    9  *
   10  *     http://www.apache.org/licenses/LICENSE-2.0
   11  *
   12  * Unless required by applicable law or agreed to in writing, software
   13  * distributed under the License is distributed on an "AS IS" BASIS,
   14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15  * See the License for the specific language governing permissions and
   16  * limitations under the License.
   17  */
   18 #ifndef _VECTOR_UTIL_H
   19 #define _VECTOR_UTIL_H
   20 
   21 #include <vector>
   22 
   23 // function to conveniently stream vectors
   24 template <class U>
   25 std::ostream& operator<<(std::ostream& os,const std::vector<U>& c){
   26   typedef std::vector<U> V;
   27   os<<"[";
   28   if(c.size()>0){
   29       for(typename V::const_iterator it=c.begin();it!=c.end();++it)
   30           os<<*it<<",";
   31       os.seekp(-1,std::ios::cur);
   32   }
   33   os<<"]";
   34   return os;
   35 }
   36 
   37 #endif // _VECTOR_UTIL_H