New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
implementation_help.hpp in vendors/XIOS/current/extern/boost/include/boost/range/detail – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/range/detail/implementation_help.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1// Boost.Range library
2//
3//  Copyright Thorsten Ottosen 2003-2004. Use, modification and
4//  distribution is subject to the Boost Software License, Version
5//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6//  http://www.boost.org/LICENSE_1_0.txt)
7//
8// For more information, see http://www.boost.org/libs/range/
9//
10
11#ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
12#define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
13
14#include <boost/range/config.hpp>
15#include <boost/range/detail/common.hpp>
16#include <boost/type_traits/is_same.hpp>
17#include <cstddef>
18#include <string.h>
19
20#ifndef BOOST_NO_CWCHAR
21#include <wchar.h>
22#endif
23
24namespace boost
25{
26    namespace range_detail
27    {
28        template <typename T>
29        inline void boost_range_silence_warning( const T& ) { }
30
31        /////////////////////////////////////////////////////////////////////
32        // end() help
33        /////////////////////////////////////////////////////////////////////
34
35        inline const char* str_end( const char* s, const char* )
36        {
37            return s + strlen( s );
38        }
39
40#ifndef BOOST_NO_CWCHAR
41        inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
42        {
43            return s + wcslen( s );
44        }
45#else
46        inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
47        {
48            if( s == 0 || s[0] == 0 )
49                return s;
50            while( *++s != 0 )
51                ;
52            return s;
53        }
54#endif
55
56        template< class Char >
57        inline Char* str_end( Char* s )
58        {
59            return const_cast<Char*>( str_end( s, s ) );
60        }
61
62        template< class T, std::size_t sz >
63        inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] )
64        {
65            return boost_range_array + sz;
66        }
67
68        template< class T, std::size_t sz >
69        inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
70        {
71            return boost_range_array + sz;
72        }
73
74        /////////////////////////////////////////////////////////////////////
75        // size() help
76        /////////////////////////////////////////////////////////////////////
77
78        template< class Char >
79        inline std::size_t str_size( const Char* const& s )
80        {
81            return str_end( s ) - s;
82        }
83
84        template< class T, std::size_t sz >
85        inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
86        {
87            boost_range_silence_warning( boost_range_array );
88            return sz;
89        }
90
91        template< class T, std::size_t sz >
92        inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] )
93        {
94            boost_range_silence_warning( boost_range_array );
95            return sz;
96        }
97
98    } // namespace 'range_detail'
99
100} // namespace 'boost'
101
102
103#endif
Note: See TracBrowser for help on using the repository browser.