1 ////////////////////////////////////////////////////////////////////////////////
3 // Copyright (c) 2001 by Andrei Alexandrescu
4 // Permission to use, copy, modify, distribute and sell this software for any
5 // purpose is hereby granted without fee, provided that the above copyright
6 // notice appear in all copies and that both that copyright notice and this
7 // permission notice appear in supporting documentation.
8 // The author makes no representations about the
9 // suitability of this software for any purpose. It is provided "as is"
10 // without express or implied warranty.
11 ////////////////////////////////////////////////////////////////////////////////
13 #ifndef FLEX_STRING_DETAILS_INC_
14 #define FLEX_STRING_DETAILS_INC_
16 // $Id: flex_string_details.h 754 2006-10-17 19:59:11Z syntheticpp $
21 namespace flex_string_details
23 template <class InIt, class OutIt>
24 OutIt copy_n(InIt b, typename std::iterator_traits<InIt>::difference_type n, OutIt d)
26 for (; n != 0; --n, ++b, ++d)
33 template <class Pod, class T>
34 inline void pod_fill(Pod *b, Pod *e, T c)
69 inline void pod_move(const Pod *b, const Pod *e, Pod *d)
72 memmove(d, b, (e - b) * sizeof(*b));
76 inline Pod *pod_copy(const Pod *b, const Pod *e, Pod *d)
78 const size_t s = e - b;
80 memcpy(d, b, s * sizeof(*b));
84 template <typename T> struct get_unsigned
89 template <> struct get_unsigned<char>
91 typedef unsigned char result;
94 template <> struct get_unsigned<signed char>
96 typedef unsigned char result;
99 template <> struct get_unsigned<short int>
101 typedef unsigned short int result;
104 template <> struct get_unsigned<int>
106 typedef unsigned int result;
109 template <> struct get_unsigned<long int>
111 typedef unsigned long int result;
117 #endif // FLEX_STRING_DETAILS_INC_