Home | History | Annotate | Download | only in fst
      1 // slist.h
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //      http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 //
     15 // Author: riley (at) google.com (Michael Riley)
     16 //
     17 // \file
     18 // Includes slist definition or defines in terms of STL list as a fallback.
     19 
     20 #ifndef FST_LIB_SLIST_H__
     21 #define FST_LIB_SLIST_H__
     22 
     23 #include <fst/config.h>
     24 
     25 #if !defined(__ANDROID__) && defined(HAVE___GNU_CXX__SLIST_INT_)
     26 
     27 #include <slist>
     28 
     29 namespace fst {
     30 
     31 using __gnu_cxx::slist;
     32 
     33 }
     34 
     35 #else
     36 
     37 #include <list>
     38 
     39 namespace fst {
     40 
     41 using std::list;
     42 
     43 template <typename T> class slist : public list<T> {
     44  public:
     45   typedef typename list<T>::iterator iterator;
     46   typedef typename list<T>::const_iterator const_iterator;
     47 
     48   using list<T>::erase;
     49 
     50   iterator erase_after(iterator pos) {
     51     iterator npos = pos;
     52     erase(++npos);
     53     return pos;
     54   }
     55 };
     56 
     57 }  // namespace fst
     58 
     59 #endif  // HAVE___GNU_CXX__SLIST_INT_
     60 
     61 #endif  // FST_LIB_SLIST_H__
     62