Browse Source

return overload

Former-commit-id: 8d82bcdd12adbe6abeb16e3142e94883a4080128
Alec Jacobson 9 years ago
parent
commit
909c4a05ff
2 changed files with 15 additions and 0 deletions
  1. 13 0
      include/igl/file_contents_as_string.cpp
  2. 2 0
      include/igl/file_contents_as_string.h

+ 13 - 0
include/igl/file_contents_as_string.cpp

@@ -9,6 +9,7 @@
 
 #include <fstream>
 #include <cstdio>
+#include <cassert>
 
 IGL_INLINE bool igl::file_contents_as_string(
   const std::string file_name,
@@ -30,3 +31,15 @@ IGL_INLINE bool igl::file_contents_as_string(
     (std::istreambuf_iterator<char>()));
   return true;
 }
+
+IGL_INLINE std::string igl::file_contents_as_string(
+  const std::string file_name)
+{
+  std::string content;
+#ifndef NDEBUG
+  bool ret = 
+#endif
+    file_contents_as_string(file_name,content);
+  assert(ret && "file_contents_as_string failed to read string from file");
+  return content;
+}

+ 2 - 0
include/igl/file_contents_as_string.h

@@ -21,6 +21,8 @@ namespace igl
   IGL_INLINE bool file_contents_as_string(
     const std::string file_name,
     std::string & content);
+  IGL_INLINE std::string file_contents_as_string(
+    const std::string file_name);
 }
 
 #ifndef IGL_STATIC_LIBRARY