c++.stlsoft - Missing Shim?
- Adi Shavit (22/22) Jul 29 2010 Hi,
- Matt Wilson (9/45) Aug 12 2010 Unfortunately, GCC does not properly detect functions used in templates
- Adi Shavit (2/61) Aug 13 2010
Hi, This code (with both options) works fine on MSVC6: <code> stlsoft::cmdargs::option res; winstl::path& sequencePath if (cmd.has_option("seqPath", -1, res)) { sequencePath = res.value; // option1 sequencePath = res.value.c_str(); // option2 // ... </code> Using CodeBlocks (http://www.codeblocks.org/) with mingw gcc does not like option1 and only accepts option2. Seems like it's missing a c_str_ptr() shim, no? These are the errors I get: ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp||In member function 'stlsoft::winstl_project::basic_path<C, T, A>& stlsoft::winstl_project::basic_path<C, T, A>::operator=(const S&) [with S = stlsoft::simple_string, C = char, T = stlsoft::winstl_project::filesystem_traits<char>, A = stlsoft::winstl_project::processheap_allocator<char>]':| ...\main.cpp|270|instantiated from here| ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp|256|error: no matching function for call to 'c_str_ptr(const stlsoft::basic_simple_string<char, stlsoft::stlsoft_char_traits<char>, std::allocator<char> >&)'| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|427|note: candidates are: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const stlsoft::ss_char_a_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\c_string.h|454|note: const stlsoft::ss_char_w_t* stlsoft::c_str_ptr(const stlsoft::ss_char_w_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\exc ption.hpp|177|note: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const std::exception&)| ||=== Build finished: 1 errors, 1 warnings ===| Adi
Jul 29 2010
Unfortunately, GCC does not properly detect functions used in templates unless they are *declared* before the template. Alas, the only other workaround (apart from specifying a C-style string, as you have done) is to ensure that the shim for the shim'd type is included before the type that will be using it. In your case, you'd need to make sure that the include for path is included before cmdargs. Matt "Adi Shavit" <adishavit_thisDoesNotBelongHere_ gmail.com> wrote in message news:i2rplk$2t3n$1 digitalmars.com...Hi, This code (with both options) works fine on MSVC6: <code> stlsoft::cmdargs::option res; winstl::path& sequencePath if (cmd.has_option("seqPath", -1, res)) { sequencePath = res.value; // option1 sequencePath = res.value.c_str(); // option2 // ... </code> Using CodeBlocks (http://www.codeblocks.org/) with mingw gcc does not like option1 and only accepts option2. Seems like it's missing a c_str_ptr() shim, no? These are the errors I get: ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp||In member function 'stlsoft::winstl_project::basic_path<C, T, A>& stlsoft::winstl_project::basic_path<C, T, A>::operator=(const S&) [with S = stlsoft::simple_string, C = char, T = stlsoft::winstl_project::filesystem_traits<char>, A = stlsoft::winstl_project::processheap_allocator<char>]':| ...\main.cpp|270|instantiated from here| ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp|256|error: no matching function for call to 'c_str_ptr(const stlsoft::basic_simple_string<char, stlsoft::stlsoft_char_traits<char>, std::allocator<char> >&)'| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\ _string.h|427|note: candidates are: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const stlsoft::ss_char_a_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\ _string.h|454|note: const stlsoft::ss_char_w_t* stlsoft::c_str_ptr(const stlsoft::ss_char_w_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\exc ption.hpp|177|note: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const std::exception&)| ||=== Build finished: 1 errors, 1 warnings ===| Adi
Aug 12 2010
Thanks, Adi Matt Wilson Wrote:Unfortunately, GCC does not properly detect functions used in templates unless they are *declared* before the template. Alas, the only other workaround (apart from specifying a C-style string, as you have done) is to ensure that the shim for the shim'd type is included before the type that will be using it. In your case, you'd need to make sure that the include for path is included before cmdargs. Matt "Adi Shavit" <adishavit_thisDoesNotBelongHere_ gmail.com> wrote in message news:i2rplk$2t3n$1 digitalmars.com...Hi, This code (with both options) works fine on MSVC6: <code> stlsoft::cmdargs::option res; winstl::path& sequencePath if (cmd.has_option("seqPath", -1, res)) { sequencePath = res.value; // option1 sequencePath = res.value.c_str(); // option2 // ... </code> Using CodeBlocks (http://www.codeblocks.org/) with mingw gcc does not like option1 and only accepts option2. Seems like it's missing a c_str_ptr() shim, no? These are the errors I get: ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp||In member function 'stlsoft::winstl_project::basic_path<C, T, A>& stlsoft::winstl_project::basic_path<C, T, A>::operator=(const S&) [with S = stlsoft::simple_string, C = char, T = stlsoft::winstl_project::filesystem_traits<char>, A = stlsoft::winstl_project::processheap_allocator<char>]':| ...\main.cpp|270|instantiated from here| ...\stlsoft-1.9.97\include\winstl\filesystem\path.hpp|256|error: no matching function for call to 'c_str_ptr(const stlsoft::basic_simple_string<char, stlsoft::stlsoft_char_traits<char>, std::allocator<char> >&)'| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\ _string.h|427|note: candidates are: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const stlsoft::ss_char_a_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\ _string.h|454|note: const stlsoft::ss_char_w_t* stlsoft::c_str_ptr(const stlsoft::ss_char_w_t*)| ...\stlsoft-1.9.97\include\stlsoft\shims\access\string\std\exc ption.hpp|177|note: const stlsoft::ss_char_a_t* stlsoft::c_str_ptr(const std::exception&)| ||=== Build finished: 1 errors, 1 warnings ===| Adi
Aug 13 2010