为 char 数组添加 Boost 文件系统路径
Boost filesystem path append for char array
代码片段是:
boost::filesystem::path petscConfigurationPath;
petscConfigurationPath.append("FluidPetsc/Basic.conf");
使用 boost 1.54 会导致以下错误:
error: no matching function for call to ‘boost::filesystem::path::append(const char [22])’
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 2 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 2 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 3 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
102:78: error: no matching function for call to ‘boost::filesystem::path::append(const char [40])’
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
102:78: note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 2 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 2 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 3 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
104:69: error: no matching function for call to ‘boost::filesystem::path::append(const char [28])’
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
104:69: note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
104:69: note: candidate expects 2 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
104:69: note: candidate expects 2 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
69: note: candidate expects 3 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
使用boost 1.57时有方法
path& append(const value_type* ptr);
template <class Source>
path& append(Source const& source);
这些方法在 1.54 版本中存在于何处?
headers(和文档)指出 append
当时需要一个 codecvt
参数(告诉追加函数如何进行字符集转换)。
这适用于 1.54:
#include <boost/filesystem.hpp>
int main() {
boost::filesystem::path petscConfigurationPath;
petscConfigurationPath.append("FluidPetsc/Basic.conf", boost::filesystem::path::codecvt());
}
代码片段是:
boost::filesystem::path petscConfigurationPath;
petscConfigurationPath.append("FluidPetsc/Basic.conf");
使用 boost 1.54 会导致以下错误:
error: no matching function for call to ‘boost::filesystem::path::append(const char [22])’
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 2 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 2 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
100:58: note: candidate expects 3 arguments, 1 provided
petscConfigurationPath.append("FluidPetsc/Basic.conf");
^
102:78: error: no matching function for call to ‘boost::filesystem::path::append(const char [40])’
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
102:78: note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 2 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 2 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
102:78: note: candidate expects 3 arguments, 1 provided
preciceConfigurationPath.append("Precice/SketchOfGeometryModeInFluid.xml");
^
104:69: error: no matching function for call to ‘boost::filesystem::path::append(const char [28])’
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
104:69: note: candidates are:
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:305:11: note: boost::filesystem::path& boost::filesystem::path::append(const value_type*, const codecvt_type&)
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
^
/usr/include/boost/filesystem/path.hpp:305:11: note: candidate expects 2 arguments, 1 provided
/usr/include/boost/filesystem/path.hpp:312:11: note: template<class Source> boost::filesystem::path& boost::filesystem::path::append(const Source&, const codecvt_type&)
path& append(Source const& source, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:312:11: note: template argument deduction/substitution failed:
104:69: note: candidate expects 2 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:315:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator)
path& append(InputIterator begin, InputIterator end)
^
/usr/include/boost/filesystem/path.hpp:315:11: note: template argument deduction/substitution failed:
104:69: note: candidate expects 2 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
In file included from /usr/include/boost/filesystem.hpp:16:0,
/usr/include/boost/filesystem/path.hpp:321:11: note: template<class InputIterator> boost::filesystem::path& boost::filesystem::path::append(InputIterator, InputIterator, const codecvt_type&)
path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt);
^
/usr/include/boost/filesystem/path.hpp:321:11: note: template argument deduction/substitution failed:
69: note: candidate expects 3 arguments, 1 provided
simulationConfigurationPath.append("FluidSimulation/Channel.xml");
^
使用boost 1.57时有方法
path& append(const value_type* ptr);
template <class Source>
path& append(Source const& source);
这些方法在 1.54 版本中存在于何处?
headers(和文档)指出 append
当时需要一个 codecvt
参数(告诉追加函数如何进行字符集转换)。
这适用于 1.54:
#include <boost/filesystem.hpp>
int main() {
boost::filesystem::path petscConfigurationPath;
petscConfigurationPath.append("FluidPetsc/Basic.conf", boost::filesystem::path::codecvt());
}