Skip to content

Instantly share code, notes, and snippets.

@jasperla
Created July 10, 2015 20:30
Show Gist options
  • Select an option

  • Save jasperla/9cdd5a937be024cd95a4 to your computer and use it in GitHub Desktop.

Select an option

Save jasperla/9cdd5a937be024cd95a4 to your computer and use it in GitHub Desktop.
/*
* compile with: eg++ -std=c++11 fail.cc
* fails:
* fail.cc: In function 'std::vector<std::basic_string<char> > to_options()':
* fail.cc:13:5: error: converting to 'std::tuple<unsigned int,
* std::basic_string<char, std::char_traits<char>, std::allocator<char> > >'
* from initializer list would use explicit constructor
* 'constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&)
* [with _U1 = int; _U2 = const char (&)[9];
* <template-parameter-2-3> = void;
* _T1 = unsigned int; _T2 = std::basic_string<char>]'
*/
#include <string>
#include <vector>
#include <set>
#include <cstdint>
#include <tuple>
#include <sys/mount.h>
using namespace std;
vector<string> to_options(void)
{
static vector<tuple<unsigned int, string>> const flags = {
{ MNT_RDONLY, "readonly" },
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment