/usr/include/loki/yasli/yasli_protocols.h is in libloki-dev 0.1.7-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #ifndef YASLI_PROTOCOLS_H_
#define YASLI_PROTOCOLS_H_
// $Id: yasli_protocols.h 754 2006-10-17 19:59:11Z syntheticpp $
#include <complex>
#include <functional>
#include "yasli_memory.h"
#include <memory.h>
namespace yasli_protocols
{
             
    // Most conservative
    template <class T>
    struct safe_move_traits
    {
        static T* destructive_move(
            T* begin, 
            T* end, 
            void* dest)
        {
            T* tdest = static_cast<T*>(dest);
            typedef std::less<T*> ls;
            assert(!ls()(tdest, end) || ls()(tdest, begin - (end - begin)));
            tdest = /*yasli*/std::uninitialized_copy(begin, end, tdest);
            if (yasli_nstd::is_class<T>::value)
            {
                for (; begin != end; ++begin)
                {
                    begin->~T();
                }
            }
            return tdest;
        }
        static T* nondestructive_move(
            T* begin, 
            T* end, 
            void* dest)
        {
            T* d = static_cast<T*>(dest);
            for (; begin != end; ++begin, ++d)
                new(d) T(*begin);
            return d;
        }
        static T* nondestructive_assign_move(
            T* begin, 
            T* end, 
            T* dest)
        {
            if (begin <= dest && dest < end)
            {
                dest += end - begin;
                T* const result = dest;
                while (begin != end)
                    *--dest = *--end;
                return result;
            }
            for (; begin != end; ++begin, ++dest)
                *dest = *begin;
            return dest;
        }
    };
    
    template <class T>
    struct memmove_traits
    {
        static T* destructive_move(
            T* begin, 
            T* end, 
            void* dest)
        {
            memmove(dest, begin, (end - begin) * sizeof(T));
            return static_cast<T*>(dest) + (end - begin);
        };
        static T* nondestructive_move(
            T* begin, 
            T* end, 
            void* dest)
        {
            memmove(dest, begin, (end - begin) * sizeof(T));
            return static_cast<T*>(dest) + (end - begin);
        }
        static T* nondestructive_assign_move(
            T* begin, 
            T* end, 
            T* dest)
        {
            yasli_nstd::destroy_range(begin, end);
            memmove(dest, begin, (end - begin) * sizeof(T));
            return static_cast<T*>(dest) + (end - begin);
        }
    };
    
    // for nonspecialized classes, use safe_move_traits
    template <class T>
    struct move_traits: public 
    yasli_nstd::type_selector<yasli_nstd::is_class<T>::value == 0,
                                          memmove_traits<T>,
                                          safe_move_traits<T>
                                      >::result
    {};    
       
    template <class T>
    struct move_traits<std::complex<T> >:public 
    yasli_nstd::type_selector<sizeof(std::complex<T>) == 2 * sizeof(T),
                                          memmove_traits< std::complex<T> >,
                                          safe_move_traits< std::complex<T> >
                                      >::result
    {
    };
}
#endif // YASLI_PROTOCOLS_H_
 |