From dc3e41c73e89162fe6a49ffbc3f5953ca6e2a65d Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Thu, 20 Jul 2017 22:39:59 +0200 Subject: [PATCH] Fixed naming of is_stl_container and is_stl_map --- doc/news/changes/minor/20170720LucaHeltai | 4 +- include/deal.II/base/patterns.h | 93 ++++++++++------------- 2 files changed, 42 insertions(+), 55 deletions(-) diff --git a/doc/news/changes/minor/20170720LucaHeltai b/doc/news/changes/minor/20170720LucaHeltai index 4096d07d37..08b8c4533c 100644 --- a/doc/news/changes/minor/20170720LucaHeltai +++ b/doc/news/changes/minor/20170720LucaHeltai @@ -1,5 +1,5 @@ -New: The new namespace Patterns::Tools contain now some -utilities that can be used to Convert from complicated types +New: The new namespace Patterns::Tools contains +utilities that can be used to convert from complicated types to strings and vice versa. These tools have been put to use in the method ParameterHandler::add_parameter() that allows users to perform in one single call the operations diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 28f43f625e..b94d26861d 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1211,36 +1211,36 @@ namespace Patterns const std::array default_map_separator {{":" , "=" , "@" , "#"}}; //specialize a type for all of the STL containers and maps - template struct is_stl_container : std::false_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - template struct is_stl_container> : std::true_type {}; - - template struct is_stl_map : std::false_type {}; - template struct is_stl_map> : std::true_type {}; - template struct is_stl_map> : std::true_type {}; - template struct is_stl_map> : std::true_type {}; - template struct is_stl_map> : std::true_type {}; + template struct is_list_compatible : std::false_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + template struct is_list_compatible> : std::true_type {}; + + template struct is_map_compatible : std::false_type {}; + template struct is_map_compatible> : std::true_type {}; + template struct is_map_compatible> : std::true_type {}; + template struct is_map_compatible> : std::true_type {}; + template struct is_map_compatible> : std::true_type {}; } // type trait to use the implementation type traits as well as decay the type template - struct is_stl_container + struct is_list_compatible { static constexpr bool const value = - internal::is_stl_container::type>::value; + internal::is_list_compatible::type>::value; }; template - struct is_stl_map + struct is_map_compatible { static constexpr bool const value = - internal::is_stl_map::type>::value; + internal::is_map_compatible::type>::value; }; namespace internal @@ -1248,7 +1248,7 @@ namespace Patterns // Rank of vector types template struct RankInfo::value>::type> + typename std::enable_if::value>::type> { static constexpr int list_rank = RankInfo::list_rank + 1; @@ -1258,7 +1258,7 @@ namespace Patterns // Rank of map types template - struct RankInfo::value>::type> + struct RankInfo::value>::type> { static constexpr int list_rank = std::max(internal::RankInfo::list_rank, @@ -1301,7 +1301,7 @@ namespace Patterns // stl containers template - struct Convert::value>::type> + struct Convert::value>::type> { static std::unique_ptr to_pattern() { @@ -1320,10 +1320,8 @@ namespace Patterns { auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage( - "I need a List pattern to convert a string to a List type.")); + AssertThrow(p, ExcMessage("I need a List pattern to convert a " + "string to a List type.")); auto base_p = p->get_base_pattern().clone(); std::vector vec(t.size()); @@ -1349,10 +1347,8 @@ namespace Patterns AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage( - "I need a List pattern to convert a string to a List type.")); + AssertThrow(p,ExcMessage("I need a List pattern to convert a string " + "to a List type.")); auto base_p = p->get_base_pattern().clone(); T t; @@ -1368,7 +1364,7 @@ namespace Patterns // stl maps template - struct Convert::value>::type> + struct Convert::value>::type> { static std::unique_ptr to_pattern() { @@ -1390,9 +1386,8 @@ namespace Patterns &pattern = Convert::to_pattern()) { auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage("I need a Map pattern to convert a string to a List type.")); + AssertThrow(p, ExcMessage("I need a Map pattern to convert a string to " + "a Map compatbile type.")); auto key_p = p->get_key_pattern().clone(); auto val_p = p->get_value_pattern().clone(); std::vector vec(t.size()); @@ -1422,9 +1417,8 @@ namespace Patterns AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage("I need a Map pattern to convert a string to a List type.")); + AssertThrow(p, ExcMessage("I need a Map pattern to convert a " + "string to a Map compatible type.")); auto key_p = p->get_key_pattern().clone(); auto val_p = p->get_value_pattern().clone(); @@ -1467,10 +1461,8 @@ namespace Patterns { auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage( - "I need a List pattern to convert a string to a List type.")); + AssertThrow(p,ExcMessage("I need a List pattern to convert a string " + "to a List compatbile type.")); auto base_p = p->get_base_pattern().clone(); std::vector vec(dim); @@ -1495,10 +1487,8 @@ namespace Patterns AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage( - "I need a List pattern to convert a string to a List type.")); + AssertThrow(p,ExcMessage("I need a List pattern to convert a string " + "to a List compatbile type.")); auto base_p = p->get_base_pattern().clone(); T t; @@ -1563,10 +1553,9 @@ namespace Patterns { auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage( - "I need a List pattern to convert a string to a List type.")); + AssertThrow(p,ExcMessage("I need a List pattern to convert a string " + "to a List compatbile type.")); + auto base_p = p->get_base_pattern().clone(); std::string s = Convert::to_string(t.real(), base_p) + @@ -1588,10 +1577,8 @@ namespace Patterns AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern)); auto p = dynamic_cast(pattern.get()); - AssertThrow( - p, - ExcMessage( - "I need a List pattern to convert a string to a List type.")); + AssertThrow(p,ExcMessage("I need a List pattern to convert a string " + "to a List compatbile type.")); auto base_p = p->get_base_pattern().clone(); -- 2.39.5