xref: /netbsd-src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/tinfo2.cc (revision b1e838363e3c6fc78a55519254d99869742dd33c)
14fee23f9Smrg // Methods for type_info for -*- C++ -*- Run Time Type Identification.
24fee23f9Smrg 
3*b1e83836Smrg // Copyright (C) 1994-2022 Free Software Foundation, Inc.
44fee23f9Smrg //
54fee23f9Smrg // This file is part of GCC.
64fee23f9Smrg //
74fee23f9Smrg // GCC is free software; you can redistribute it and/or modify
84fee23f9Smrg // it under the terms of the GNU General Public License as published by
94fee23f9Smrg // the Free Software Foundation; either version 3, or (at your option)
104fee23f9Smrg // any later version.
114fee23f9Smrg 
124fee23f9Smrg // GCC is distributed in the hope that it will be useful,
134fee23f9Smrg // but WITHOUT ANY WARRANTY; without even the implied warranty of
144fee23f9Smrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
154fee23f9Smrg // GNU General Public License for more details.
164fee23f9Smrg 
174fee23f9Smrg // Under Section 7 of GPL version 3, you are granted additional
184fee23f9Smrg // permissions described in the GCC Runtime Library Exception, version
194fee23f9Smrg // 3.1, as published by the Free Software Foundation.
204fee23f9Smrg 
214fee23f9Smrg // You should have received a copy of the GNU General Public License and
224fee23f9Smrg // a copy of the GCC Runtime Library Exception along with this program;
234fee23f9Smrg // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
244fee23f9Smrg // <http://www.gnu.org/licenses/>.
254fee23f9Smrg 
264fee23f9Smrg #include <cstddef>
274fee23f9Smrg #include "tinfo.h"
284fee23f9Smrg 
294fee23f9Smrg using std::type_info;
304fee23f9Smrg 
314fee23f9Smrg #if !__GXX_TYPEINFO_EQUALITY_INLINE
324fee23f9Smrg 
334fee23f9Smrg bool
before(const type_info & arg) const3448fb7bfaSmrg type_info::before (const type_info &arg) const _GLIBCXX_NOEXCEPT
354fee23f9Smrg {
364fee23f9Smrg #if __GXX_MERGED_TYPEINFO_NAMES
374fee23f9Smrg   return name () < arg.name ();
384fee23f9Smrg #else
39*b1e83836Smrg   /* The name() method will strip any leading '*' prefix. Therefore
40*b1e83836Smrg      take care to look at __name rather than name() when looking for
41*b1e83836Smrg      the "pointer" prefix.  */
42*b1e83836Smrg   return (__name[0] == '*') ? name () < arg.name ()
434fee23f9Smrg     :  __builtin_strcmp (name (), arg.name ()) < 0;
444fee23f9Smrg #endif
454fee23f9Smrg }
464fee23f9Smrg 
474fee23f9Smrg #endif
48