Skip to content
Snippets Groups Projects
Commit 51411d65 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

tidy: drop use of c arrays

parent 0939e824
No related branches found
No related tags found
1 merge request!211Merge jt
...@@ -42,22 +42,6 @@ public: ...@@ -42,22 +42,6 @@ public:
} }
}; };
   
template < size_t N >
class ObjectFactoryImpl < char ( & ) [ N ] > {
public:
static Object construct ( char * string ) {
return ObjectFactoryImpl < std::string >::construct ( std::string ( string ) );
}
};
template < size_t N >
class ObjectFactoryImpl < const char ( & ) [ N ] > {
public:
static Object construct ( const char * string ) {
return ObjectFactoryImpl < std::string >::construct ( std::string ( string ) );
}
};
template < > template < >
class ObjectFactoryImpl < const char * const & > { class ObjectFactoryImpl < const char * const & > {
public: public:
...@@ -229,7 +213,7 @@ class ObjectFactory < Object > { ...@@ -229,7 +213,7 @@ class ObjectFactory < Object > {
public: public:
template < class Param > template < class Param >
static Object construct ( Param && param ) { static Object construct ( Param && param ) {
return ObjectFactoryImpl < Param >::construct ( std::forward < Param > ( param ) );; return ObjectFactoryImpl < typename ext::array_to_ptr < Param >::type >::construct ( std::forward < Param > ( param ) );;
} }
}; };
   
......
...@@ -171,5 +171,17 @@ namespace ext { ...@@ -171,5 +171,17 @@ namespace ext {
typedef T & type; typedef T & type;
}; };
   
template< class T >
struct array_to_ptr {
private:
typedef typename std::remove_reference < T >::type U;
public:
typedef typename std::conditional <
std::is_array < U >::value,
typename std::remove_extent < U >::type *,
T
>::type type;
};
} /* namespace ext */ } /* namespace ext */
   
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment