PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - usr/include/c++/4.4.7/bits - stl_construct.h (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 15 15 100.0 %
Date: 2014-12-13 Functions: 10 10 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // nonstandard construct and destroy functions -*- C++ -*-
       2             : 
       3             : // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
       4             : // Free Software Foundation, Inc.
       5             : //
       6             : // This file is part of the GNU ISO C++ Library.  This library is free
       7             : // software; you can redistribute it and/or modify it under the
       8             : // terms of the GNU General Public License as published by the
       9             : // Free Software Foundation; either version 3, or (at your option)
      10             : // any later version.
      11             : 
      12             : // This library is distributed in the hope that it will be useful,
      13             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             : // GNU General Public License for more details.
      16             : 
      17             : // Under Section 7 of GPL version 3, you are granted additional
      18             : // permissions described in the GCC Runtime Library Exception, version
      19             : // 3.1, as published by the Free Software Foundation.
      20             : 
      21             : // You should have received a copy of the GNU General Public License and
      22             : // a copy of the GCC Runtime Library Exception along with this program;
      23             : // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      24             : // <http://www.gnu.org/licenses/>.
      25             : 
      26             : /*
      27             :  *
      28             :  * Copyright (c) 1994
      29             :  * Hewlett-Packard Company
      30             :  *
      31             :  * Permission to use, copy, modify, distribute and sell this software
      32             :  * and its documentation for any purpose is hereby granted without fee,
      33             :  * provided that the above copyright notice appear in all copies and
      34             :  * that both that copyright notice and this permission notice appear
      35             :  * in supporting documentation.  Hewlett-Packard Company makes no
      36             :  * representations about the suitability of this software for any
      37             :  * purpose.  It is provided "as is" without express or implied warranty.
      38             :  *
      39             :  *
      40             :  * Copyright (c) 1996,1997
      41             :  * Silicon Graphics Computer Systems, Inc.
      42             :  *
      43             :  * Permission to use, copy, modify, distribute and sell this software
      44             :  * and its documentation for any purpose is hereby granted without fee,
      45             :  * provided that the above copyright notice appear in all copies and
      46             :  * that both that copyright notice and this permission notice appear
      47             :  * in supporting documentation.  Silicon Graphics makes no
      48             :  * representations about the suitability of this software for any
      49             :  * purpose.  It is provided "as is" without express or implied warranty.
      50             :  */
      51             : 
      52             : /** @file stl_construct.h
      53             :  *  This is an internal header file, included by other library headers.
      54             :  *  You should not attempt to use it directly.
      55             :  */
      56             : 
      57             : #ifndef _STL_CONSTRUCT_H
      58             : #define _STL_CONSTRUCT_H 1
      59             : 
      60             : #include <new>
      61             : 
      62             : _GLIBCXX_BEGIN_NAMESPACE(std)
      63             : 
      64             :   /**
      65             :    * Constructs an object in existing memory by invoking an allocated
      66             :    * object's constructor with an initializer.
      67             :    */
      68             :   template<typename _T1, typename _T2>
      69             :     inline void
      70             : #ifdef __GXX_EXPERIMENTAL_CXX0X__
      71             :     _Construct(_T1* __p, _T2&& __value)
      72             :     {
      73             :       ::new(static_cast<void*>(__p)) _T1(std::forward<_T2>(__value));
      74             :     }
      75             : #else
      76         178 :     _Construct(_T1* __p, const _T2& __value)
      77             :     {
      78             :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
      79             :       // 402. wrong new expression in [some_]allocator::construct
      80         178 :       ::new(static_cast<void*>(__p)) _T1(__value);
      81         178 :     }
      82             : #endif
      83             : 
      84             :   /**
      85             :    * Destroy the object pointed to by a pointer type.
      86             :    */
      87             :   template<typename _Tp>
      88             :     inline void
      89         178 :     _Destroy(_Tp* __pointer)
      90         178 :     { __pointer->~_Tp(); }
      91             : 
      92             :   template<bool>
      93             :     struct _Destroy_aux
      94             :     {
      95             :       template<typename _ForwardIterator>
      96             :         static void
      97         148 :         __destroy(_ForwardIterator __first, _ForwardIterator __last)
      98             :         {
      99         326 :           for (; __first != __last; ++__first)
     100         178 :             std::_Destroy(&*__first);
     101         148 :         }
     102             :     };
     103             : 
     104             :   template<>
     105             :     struct _Destroy_aux<true>
     106             :     {
     107             :       template<typename _ForwardIterator>
     108             :         static void
     109             :         __destroy(_ForwardIterator, _ForwardIterator) { }
     110             :     };
     111             : 
     112             :   /**
     113             :    * Destroy a range of objects.  If the value_type of the object has
     114             :    * a trivial destructor, the compiler should optimize all of this
     115             :    * away, otherwise the objects' destructors must be invoked.
     116             :    */
     117             :   template<typename _ForwardIterator>
     118             :     inline void
     119         148 :     _Destroy(_ForwardIterator __first, _ForwardIterator __last)
     120             :     {
     121             :       typedef typename iterator_traits<_ForwardIterator>::value_type
     122             :                        _Value_type;
     123         148 :       std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
     124             :         __destroy(__first, __last);
     125         148 :     }
     126             : 
     127             :   /**
     128             :    * Destroy a range of objects using the supplied allocator.  For
     129             :    * nondefault allocators we do not optimize away invocation of 
     130             :    * destroy() even if _Tp has a trivial destructor.
     131             :    */
     132             : 
     133             :   template <typename _Tp> class allocator;
     134             : 
     135             :   template<typename _ForwardIterator, typename _Allocator>
     136             :     void
     137             :     _Destroy(_ForwardIterator __first, _ForwardIterator __last,
     138             :              _Allocator& __alloc)
     139             :     {
     140             :       for (; __first != __last; ++__first)
     141             :         __alloc.destroy(&*__first);
     142             :     }
     143             : 
     144             :   template<typename _ForwardIterator, typename _Tp>
     145             :     inline void
     146         148 :     _Destroy(_ForwardIterator __first, _ForwardIterator __last,
     147             :              allocator<_Tp>&)
     148             :     {
     149         148 :       _Destroy(__first, __last);
     150         148 :     }
     151             : 
     152             : _GLIBCXX_END_NAMESPACE
     153             : 
     154             : #endif /* _STL_CONSTRUCT_H */
     155             : 

Generated by: LCOV version 1.10

Generated at Sat, 13 Dec 2014 06:16:06 +0000 (5 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.