2017-11-06 8 views
1

는 :초기화 목록 생성자 수용 반복자

#include <initializer_list> 
#include <iterator> 

int main() 
{ 
    int parameters[4]{1, 2, 3, 4}; 
    auto b = std::begin(parameters); 
    auto e = std::end(parameters); 
    std::initializer_list<int> il(b,e); // where is the constructor specified in the standard? 
} 

나는 another question에 답이 동작을 사용하지만, 몇 가지 조사를하는 동안 나는이 생성자는 not actually in the standard 것으로 나타났습니다.

/Za/permissive- 플래그가있는 언어 확장 기능을 해제했지만 여전히 컴파일됩니다.

MSVC의 버그입니까?

+0

흠을 것 같다. 왜 내가 downvote 궁금해? – wally

+0

gcc도 clang도 이것을 컴파일하지 않으므로 VS 확장자처럼 보입니다 – bolov

+0

@bolov'/ Za' 플래그가 무시되는 버그라고 생각합니까? – wally

답변

2

실제로 MSDN에 문서화 :

constexpr의 initializer_list() noexcept;

initializer_list (const InputIterator first, const InputIterator Last);

하지만 VS-특정 기능