Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <type_traits>
  2.  
  3. template <typename T>
  4. inline constexpr std::remove_reference_t<T> &lvalue(T &&r) noexcept {
  5. return static_cast<std::remove_reference_t<T> &>(r);
  6. }
  7.  
  8. std::string get_my_file() {
  9. auto ifs = std::ifstream("myfile.txt");
  10. return {std::istreambuf_iterator<char>(ifs),
  11. std::istreambuf_iterator<char>()};
  12. }
  13.  
  14. std::string get_my_file() {
  15. return {std::istreambuf_iterator<char>(lvalue(std::ifstream("myfile.txt"))),
  16. std::istreambuf_iterator<char>()};
  17. }
  18.  
  19. std::string temp1 = get_my_shader();
  20. const char *temp2 = temp1.c_str();
  21. glShaderSource(a, 1, &temp2, nullptr);
  22.  
  23. glShaderSource(a, 1, &lvalue(get_my_shader().c_str()), nullptr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement