OSDN Git Service

配列の参照って、めっちゃ変な書き方しよるなぁ・・・
authormyun2 <myun2@nwhite.info>
Tue, 29 Nov 2011 08:54:03 +0000 (17:54 +0900)
committermyun2 <myun2@nwhite.info>
Tue, 29 Nov 2011 08:54:03 +0000 (17:54 +0900)
roast/include/roast/lexical/variable/array.hpp
roast/test/lexical_test/lex_var_test.cpp

index 51a5b41..5d04b7a 100644 (file)
@@ -16,7 +16,7 @@ namespace roast
                        struct array : public _basic_type<T[N]>
                        {
                                array(){}
-                               array(const T[N] &v):_basic_type<T[N]>(v){}
+                               array(const T (&v)[N]):_basic_type<T[N]>(v){}
                        };
                        
                        /////
@@ -25,28 +25,28 @@ namespace roast
                        struct char_array : public array<char,N>
                        {
                                char_array(){}
-                               char_array(const char[N] &v):array<char,N>(v){}
+                               char_array(const char(&v)[N]):array<char,N>(v){}
                        };
                        
                        template <unsigned int N>
                        struct short_array : public array<short,N>
                        {
                                short_array(){}
-                               short_array(const short[N] &v):array<short,N>(v){}
+                               short_array(const short(&v)[N]):array<short,N>(v){}
                        };
                        
                        template <unsigned int N>
                        struct int_array : public array<int,N>
                        {
                                int_array(){}
-                               int_array(const int[N] &v):array<int,N>(v){}
+                               int_array(const int(&v)[N]):array<int,N>(v){}
                        };
                        
                        template <unsigned int N>
                        struct long_array : public array<long,N>
                        {
                                long_array(){}
-                               long_array(const long[N] &v):array<long,N>(v){}
+                               long_array(const long(&v)[N]):array<long,N>(v){}
                        };
 
                        ///////
@@ -55,28 +55,28 @@ namespace roast
                        struct uchar_array : public array<unsigned char,N>
                        {
                                uchar_array(){}
-                               uchar_array(const unsigned char[N] &v):array<unsigned char,N>(v){}
+                               uchar_array(const unsigned char(&v)[N]):array<unsigned char,N>(v){}
                        };
                        
                        template <unsigned int N>
                        struct ushort_array : public array<unsigned short,N>
                        {
                                ushort_array(){}
-                               ushort_array(const unsigned short[N] &v):array<unsigned short,N>(v){}
+                               ushort_array(const unsigned short(&v)[N]):array<unsigned short,N>(v){}
                        };
                        
                        template <unsigned int N>
                        struct uint_array : public array<unsigned int,N>
                        {
                                uint_array(){}
-                               uint_array(const unsigned int[N] &v):array<unsigned int,N>(v){}
+                               uint_array(const unsigned int(&v)[N]):array<unsigned int,N>(v){}
                        };
                        
                        template <unsigned int N>
                        struct ulong_array : public array<unsigned long,N>
                        {
                                ulong_array(){}
-                               ulong_array(const unsigned long[N] &v):array<unsigned long,N>(v){}
+                               ulong_array(const unsigned long(&v)[N]):array<unsigned long,N>(v){}
                        };
 
                        //////////////////////////////////////////////////////
index e1afd1c..d2932f8 100644 (file)
@@ -26,5 +26,7 @@ int main()
        printf("%d\n", aaa );
        printf("%d\n", hugi.get<int>() );
 
+       int_array<4> ia;
+
        return 0;
 }